|
| 1 | +import Vue from 'vue' |
| 2 | +import VueAxe from '../../../vue-axe' |
| 3 | + |
| 4 | +const config = { |
| 5 | + rules: [ |
| 6 | + { id: 'heading-order', enabled: true }, |
| 7 | + { id: 'label-title-only', enabled: true }, |
| 8 | + { id: 'link-in-text-block', enabled: true }, |
| 9 | + { id: 'region', enabled: true }, |
| 10 | + { id: 'skip-link', enabled: true }, |
| 11 | + { id: 'help-same-as-label', enabled: true } |
| 12 | + ] |
| 13 | +} |
| 14 | + |
| 15 | +describe('Home-VueAxe', () => { |
| 16 | + beforeEach(() => { |
| 17 | + cy.visit('/') |
| 18 | + }) |
| 19 | + |
| 20 | + it('Should display the main headline', () => { |
| 21 | + cy.get('[data-va="main header"]').should('be.visible') |
| 22 | + }) |
| 23 | + |
| 24 | + it('should assert that page content is correct', () => { |
| 25 | + cy.get('[data-va="main header"]').should('contain', 'Welcome') |
| 26 | + }) |
| 27 | + |
| 28 | + it('should run axe in the context of the document', () => { |
| 29 | + cy.visit('/') |
| 30 | + .then(win => { |
| 31 | + console.log(win.console) |
| 32 | + cy.spy(win.console, 'group') |
| 33 | + cy.spy(win.console, 'groupCollapsed') |
| 34 | + cy.spy(win.console, 'groupEnd') |
| 35 | + |
| 36 | + VueAxe(Vue, config) |
| 37 | + .then(() => { |
| 38 | + expect(win.console.group).to.be.calledWith('%cNew aXe issues', 'padding:6px;font-size:20px;background-color:#8ba6c5;color:#fff;font-weight:bold;') |
| 39 | + expect(win.console.groupCollapsed).to.be.calledWith('%c%s: %c%s %s') |
| 40 | + expect(win.console.groupEnd).to.be.called |
| 41 | + }) |
| 42 | + }) |
| 43 | + }) |
| 44 | +}) |
0 commit comments