forked from cypress-io/cypress-react-unit-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec.js
42 lines (39 loc) · 949 Bytes
/
spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/// <reference types="cypress" />
import React from 'react'
import { mount } from 'cypress-react-unit-test'
describe('Accessibility', () => {
before(() => {
// https://github.com/avanslaars/cypress-axe
cy.injectAxe()
})
// https://www.w3.org/WAI/standards-guidelines/aria/
context('aria', () => {
// skip a failing test on purpose
it.skip('catches missing aria-* label', () => {
mount(<input type="text" value="John Smith" name="name" />)
cy.checkA11y('input', {
runOnly: {
type: 'tag',
values: ['wcag2a'],
},
})
})
it('passes', () => {
mount(
<input
type="text"
aria-label="label text"
aria-required="true"
value="John Smith"
name="name"
/>,
)
cy.checkA11y('input', {
runOnly: {
type: 'tag',
values: ['wcag2a'],
},
})
})
})
})