|
1 | | -import { fixture, expect } from "@open-wc/testing"; |
2 | | -import { Scanner } from "../src/scanner"; |
3 | | -import ariaValidAttr from "../src/rules/aria-valid-attr"; |
4 | | - |
5 | | -const scanner = new Scanner([ariaValidAttr]); |
6 | | - |
7 | | -const passes = [ |
8 | | - '<div id="target" role="switch" tabindex="1" aria-checked="false">', |
9 | | - // TODO // '<div id="target"></div>', |
10 | | - '<input id="target" type="range" role="slider">', |
11 | | - '<input id="target" type="checkbox" role="switch">', |
12 | | - '<div id="target" role="separator"></div>', |
13 | | - '<div id="target" role="combobox" aria-expanded="false"></div>', |
14 | | - '<div id="target" role="combobox" aria-expanded="true" aria-controls="test"></div>', |
15 | | -]; |
16 | | -const violations = [ |
17 | | - '<div id="target" role="switch" tabindex="1">', |
18 | | - '<div id="target" role="switch" tabindex="1" aria-checked>', |
19 | | - '<div id="target" role="switch" tabindex="1" aria-checked="">', |
20 | | - '<div id="target" role="separator" tabindex="0"></div>', |
21 | | - '<div id="target" role="combobox" aria-expanded="invalid-value"></div>', |
22 | | - '<div id="target" role="combobox" aria-expanded="true" aria-owns="ownedchild"></div>', |
23 | | - '<div id="target" role="combobox"></div>', |
24 | | - '<div id="target" role="combobox" aria-expanded="true"></div>', |
25 | | -]; |
26 | | - |
27 | | -describe("aria-required-attr", async function () { |
28 | | - for (const markup of passes) { |
29 | | - const el = await fixture(markup); |
30 | | - it(el.outerHTML, async () => { |
31 | | - const results = (await scanner.scan(el)).map(({ text, url }) => { |
32 | | - return { text, url }; |
33 | | - }); |
34 | | - |
35 | | - expect(results).to.be.empty; |
36 | | - }); |
37 | | - } |
38 | | - |
39 | | - for (const markup of violations) { |
40 | | - const el = await fixture(markup); |
41 | | - it(el.outerHTML, async () => { |
42 | | - const results = (await scanner.scan(el)).map(({ text, url }) => { |
43 | | - return { text, url }; |
44 | | - }); |
45 | | - |
46 | | - expect(results).to.eql([ |
47 | | - { |
48 | | - text: "ARIA attributes must conform to valid names", |
49 | | - url: "https://dequeuniversity.com/rules/axe/4.4/aria-valid-attr", |
50 | | - }, |
51 | | - ]); |
52 | | - }); |
53 | | - } |
54 | | -}); |
| 1 | +// import { fixture, expect } from "@open-wc/testing"; |
| 2 | +// import { Scanner } from "../src/scanner"; |
| 3 | +// import ariaValidAttr from "../src/rules/aria-valid-attr"; |
| 4 | +// |
| 5 | +// const scanner = new Scanner([ariaValidAttr]); |
| 6 | +// |
| 7 | +// // TODO |
| 8 | +// const passes = [ |
| 9 | +// // '<div id="target" role="switch" tabindex="1" aria-checked="false">', |
| 10 | +// // '<div id="target"></div>', |
| 11 | +// // '<input id="target" type="range" role="slider">', |
| 12 | +// // '<input id="target" type="checkbox" role="switch">', |
| 13 | +// // '<div id="target" role="separator"></div>', |
| 14 | +// // '<div id="target" role="combobox" aria-expanded="false"></div>', |
| 15 | +// // '<div id="target" role="combobox" aria-expanded="true" aria-controls="test"></div>', |
| 16 | +// ]; |
| 17 | +// const violations = [ |
| 18 | +// // '<div id="target" role="switch" tabindex="1">', |
| 19 | +// // '<div id="target" role="switch" tabindex="1" aria-checked>', |
| 20 | +// // '<div id="target" role="switch" tabindex="1" aria-checked="">', |
| 21 | +// // '<div id="target" role="separator" tabindex="0"></div>', |
| 22 | +// // '<div id="target" role="combobox" aria-expanded="invalid-value"></div>', |
| 23 | +// // '<div id="target" role="combobox" aria-expanded="true" aria-owns="ownedchild"></div>', |
| 24 | +// // '<div id="target" role="combobox"></div>', |
| 25 | +// // '<div id="target" role="combobox" aria-expanded="true"></div>', |
| 26 | +// ]; |
| 27 | +// |
| 28 | +// describe.skip("aria-required-attr", async function () { |
| 29 | +// for (const markup of passes) { |
| 30 | +// const el = await fixture(markup); |
| 31 | +// it(el.outerHTML, async () => { |
| 32 | +// const results = (await scanner.scan(el)).map(({ text, url }) => { |
| 33 | +// return { text, url }; |
| 34 | +// }); |
| 35 | +// |
| 36 | +// expect(results).to.be.empty; |
| 37 | +// }); |
| 38 | +// } |
| 39 | +// |
| 40 | +// for (const markup of violations) { |
| 41 | +// const el = await fixture(markup); |
| 42 | +// it(el.outerHTML, async () => { |
| 43 | +// const results = (await scanner.scan(el)).map(({ text, url }) => { |
| 44 | +// return { text, url }; |
| 45 | +// }); |
| 46 | +// |
| 47 | +// expect(results).to.eql([ |
| 48 | +// { |
| 49 | +// text: "ARIA attributes must conform to valid names", |
| 50 | +// url: "https://dequeuniversity.com/rules/axe/4.4/aria-valid-attr", |
| 51 | +// }, |
| 52 | +// ]); |
| 53 | +// }); |
| 54 | +// } |
| 55 | +// }); |
| 56 | +// |
0 commit comments