axe-core 2.4.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/appveyor.yml +21 -0
  4. package/axe.d.ts +1 -1
  5. package/axe.js +489 -222
  6. package/axe.min.js +6 -6
  7. package/bower.json +1 -1
  8. package/build/sri-update.js +10 -0
  9. package/build/utils/postinstall.js +3 -3
  10. package/doc/API.md +16 -2
  11. package/doc/developer-guide.md +25 -0
  12. package/doc/examples/jasmine/package.json +1 -1
  13. package/doc/examples/jest+react/package.json +1 -1
  14. package/doc/examples/mocha/package.json +1 -1
  15. package/doc/examples/qunit/package.json +1 -1
  16. package/doc/examples/selenium/package.json +1 -1
  17. package/doc/projects.md +2 -1
  18. package/doc/rule-descriptions.md +2 -0
  19. package/doc/rule-development.md +56 -10
  20. package/lib/checks/aria/errormessage.js +25 -0
  21. package/lib/checks/aria/errormessage.json +11 -0
  22. package/lib/checks/aria/required-children.js +16 -7
  23. package/lib/checks/aria/valid-attr-value.js +8 -3
  24. package/lib/checks/color/color-contrast.js +2 -1
  25. package/lib/checks/color/color-contrast.json +3 -1
  26. package/lib/checks/keyboard/has-at-least-one-main-after.js +16 -0
  27. package/lib/checks/keyboard/has-at-least-one-main.js +3 -0
  28. package/lib/checks/keyboard/has-at-least-one-main.json +12 -0
  29. package/lib/checks/keyboard/has-no-more-than-one-main.js +2 -0
  30. package/lib/checks/keyboard/has-no-more-than-one-main.json +11 -0
  31. package/lib/checks/keyboard/main-is-top-level.js +15 -0
  32. package/lib/checks/keyboard/main-is-top-level.json +11 -0
  33. package/lib/checks/lists/dlitem.js +1 -1
  34. package/lib/checks/navigation/region.js +15 -4
  35. package/lib/checks/navigation/skip-link.js +2 -1
  36. package/lib/commons/aria/attributes.js +19 -7
  37. package/lib/commons/aria/index.js +26 -15
  38. package/lib/commons/aria/roles.js +39 -15
  39. package/lib/commons/color/contrast.js +29 -8
  40. package/lib/commons/color/element-is-distinct.js +17 -2
  41. package/lib/commons/color/get-background-color.js +111 -11
  42. package/lib/commons/color/get-foreground-color.js +5 -2
  43. package/lib/commons/color/incomplete-data.js +14 -2
  44. package/lib/commons/color/index.js +6 -0
  45. package/lib/commons/dom/elements-below-floating.js +3 -1
  46. package/lib/commons/dom/find-up.js +5 -3
  47. package/lib/commons/dom/get-element-by-reference.js +11 -2
  48. package/lib/commons/dom/get-element-coordinates.js +17 -16
  49. package/lib/commons/dom/get-scroll-offset.js +6 -3
  50. package/lib/commons/dom/get-viewport-size.js +6 -5
  51. package/lib/commons/dom/idrefs.js +8 -3
  52. package/lib/commons/dom/index.js +8 -1
  53. package/lib/commons/dom/is-focusable.js +28 -9
  54. package/lib/commons/dom/is-html5.js +11 -2
  55. package/lib/commons/dom/is-in-text-block.js +6 -2
  56. package/lib/commons/dom/is-node.js +11 -3
  57. package/lib/commons/dom/is-offscreen.js +10 -2
  58. package/lib/commons/dom/is-visible.js +9 -3
  59. package/lib/commons/dom/is-visual-content.js +8 -5
  60. package/lib/commons/dom/visually-contains.js +3 -0
  61. package/lib/commons/dom/visually-overlaps.js +3 -0
  62. package/lib/commons/index.js +8 -0
  63. package/lib/commons/table/get-all-cells.js +10 -1
  64. package/lib/commons/table/get-cell-position.js +7 -4
  65. package/lib/commons/table/get-headers.js +6 -3
  66. package/lib/commons/table/get-scope.js +8 -5
  67. package/lib/commons/table/index.js +8 -1
  68. package/lib/commons/table/is-column-header.js +8 -5
  69. package/lib/commons/table/is-data-cell.js +6 -3
  70. package/lib/commons/table/is-data-table.js +6 -3
  71. package/lib/commons/table/is-header.js +5 -2
  72. package/lib/commons/table/is-row-header.js +8 -5
  73. package/lib/commons/table/to-grid.js +5 -2
  74. package/lib/commons/table/traverse.js +9 -6
  75. package/lib/commons/text/accessible-text.js +12 -6
  76. package/lib/commons/text/index.js +9 -2
  77. package/lib/commons/text/sanitize.js +10 -1
  78. package/lib/commons/utils/index.js +9 -3
  79. package/lib/commons/utils/to-array.js +11 -2
  80. package/lib/commons/utils/token-list.js +10 -3
  81. package/lib/commons/utils/valid-langs.js +11 -3
  82. package/lib/core/base/audit.js +1 -1
  83. package/lib/core/public/load.js +1 -1
  84. package/lib/core/reporters/helpers/process-aggregate.js +32 -0
  85. package/lib/core/reporters/no-passes.js +3 -0
  86. package/lib/core/utils/{aggregateRule.js → aggregateNodeResults.js} +18 -13
  87. package/lib/core/utils/check-helper.js +1 -1
  88. package/lib/core/utils/contains.js +4 -1
  89. package/lib/core/utils/finalize-result.js +1 -1
  90. package/lib/core/utils/find-by.js +4 -1
  91. package/lib/core/utils/get-selector.js +9 -4
  92. package/lib/core/utils/index.js +8 -1
  93. package/lib/core/utils/is-hidden.js +4 -1
  94. package/lib/core/utils/is-xhtml.js +16 -0
  95. package/lib/core/utils/pollyfills.js +136 -128
  96. package/lib/core/utils/rule-should-run.js +1 -1
  97. package/lib/rules/aria-valid-attr-value.json +4 -3
  98. package/lib/rules/color-contrast-matches.js +1 -1
  99. package/lib/rules/landmark-main-is-top-level.json +16 -0
  100. package/lib/rules/landmark-one-main.json +17 -0
  101. package/lib/rules/th-has-data-cells.json +1 -1
  102. package/package.json +7 -4
  103. package/sri-history.json +20 -0
  104. package/test/checks/aria/allowed-attr.js +13 -1
  105. package/test/checks/aria/errormessage.js +49 -0
  106. package/test/checks/aria/required-children.js +34 -4
  107. package/test/checks/color/color-contrast.js +33 -2
  108. package/test/checks/index.html +9 -0
  109. package/test/checks/keyboard/has-at-least-one-main.js +68 -0
  110. package/test/checks/keyboard/has-no-more-than-one-main.js +34 -0
  111. package/test/checks/keyboard/main-is-top-level.js +58 -0
  112. package/test/commons/aria/attributes.js +29 -29
  113. package/test/commons/aria/roles.js +29 -29
  114. package/test/commons/color/contrast.js +8 -0
  115. package/test/commons/color/get-background-color.js +26 -0
  116. package/test/commons/dom/is-natively-focusable.js +138 -0
  117. package/test/commons/index.html +3 -0
  118. package/test/core/base/audit.js +48 -0
  119. package/test/core/base/check.js +1 -1
  120. package/test/core/index.html +11 -4
  121. package/test/core/public/run-rules.js +27 -1
  122. package/test/core/reporters/helpers/process-aggregate.js +290 -0
  123. package/test/core/utils/{aggregateRule.js → aggregateNodeResults.js} +10 -14
  124. package/test/core/utils/finalize-result.js +7 -7
  125. package/test/core/utils/get-selector.js +14 -0
  126. package/test/core/utils/is-xhtml.js +21 -0
  127. package/test/integration/full/async/async.html +29 -0
  128. package/test/integration/full/async/async.js +102 -0
  129. package/test/integration/full/definition-list/dlitem-xhtml.js +52 -0
  130. package/test/integration/full/definition-list/dlitem-xhtml.xhtml +30 -0
  131. package/test/integration/full/get-selector/get-selector.js +12 -0
  132. package/test/integration/full/get-selector/get-selector.xhtml +25 -0
  133. package/test/integration/full/is-xhtml/is-xhtml.js +9 -0
  134. package/test/integration/full/is-xhtml/is-xhtml.xhtml +24 -0
  135. package/test/integration/full/landmark-main-is-top-level/frames/level1-fail.html +17 -0
  136. package/test/integration/full/landmark-main-is-top-level/frames/level1.html +29 -0
  137. package/test/integration/full/landmark-main-is-top-level/frames/level2-a.html +15 -0
  138. package/test/integration/full/landmark-main-is-top-level/frames/level2.html +15 -0
  139. package/test/integration/full/landmark-main-is-top-level/landmark-main-is-top-level-fail.html +29 -0
  140. package/test/integration/full/landmark-main-is-top-level/landmark-main-is-top-level-fail.js +42 -0
  141. package/test/integration/full/landmark-main-is-top-level/landmark-main-is-top-level-pass.html +42 -0
  142. package/test/integration/full/landmark-main-is-top-level/landmark-main-is-top-level-pass.js +36 -0
  143. package/test/integration/full/landmark-one-main/frames/level1-fail.html +10 -0
  144. package/test/integration/full/landmark-one-main/frames/level1.html +12 -0
  145. package/test/integration/full/landmark-one-main/frames/level2-a.html +12 -0
  146. package/test/integration/full/landmark-one-main/frames/level2.html +10 -0
  147. package/test/integration/full/landmark-one-main/landmark-one-main-fail.html +24 -0
  148. package/test/integration/full/landmark-one-main/landmark-one-main-fail.js +46 -0
  149. package/test/integration/full/landmark-one-main/landmark-one-main-pass.html +24 -0
  150. package/test/integration/full/landmark-one-main/landmark-one-main-pass.js +55 -0
  151. package/test/integration/full/region/region-fail.html +3 -0
  152. package/test/integration/full/region/region-pass.html +10 -0
  153. package/test/integration/rules/aria-allowed-attr/failures.html +2 -0
  154. package/test/integration/rules/aria-allowed-attr/failures.json +2 -2
  155. package/test/integration/rules/aria-allowed-attr/passes.html +9 -3
  156. package/test/integration/rules/aria-allowed-attr/passes.json +3 -2
  157. package/test/integration/rules/aria-valid-attr-value/aria-valid-attr-value.html +5 -0
  158. package/test/integration/rules/aria-valid-attr-value/aria-valid-attr-value.json +3 -2
  159. package/test/integration/rules/color-contrast/color-contrast.html +0 -5
  160. package/test/integration/rules/color-contrast/color-contrast.json +0 -2
  161. package/test/integration/rules/index.html +1 -0
  162. package/test/rule-matches/color-contrast-matches.js +10 -0
  163. package/test/rule-matches/index.html +1 -0
  164. package/test/runner.tmpl +1 -0
  165. package/test/testutils.js +43 -0
  166. package/typings/axe-core/axe-core-tests.js +10 -1
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html lang="en" id="fail1">
3
+ <head>
4
+ <meta charset="utf8">
5
+ <link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" />
6
+ <script src="/node_modules/mocha/mocha.js"></script>
7
+ <script src="/node_modules/chai/chai.js"></script>
8
+ <script src="/axe.js"></script>
9
+ <script>
10
+ mocha.setup({
11
+ timeout: 10000,
12
+ ui: 'bdd'
13
+ });
14
+ var assert = chai.assert;
15
+ </script>
16
+ </head>
17
+ <body>
18
+ <p>No main content here</p>
19
+ <iframe id="frame1" src="frames/level1-fail.html"></iframe>
20
+ <div id="mocha"></div>
21
+ <script src="landmark-one-main-fail.js"></script>
22
+ <script src="/test/integration/adapter.js"></script>
23
+ </body>
24
+ </html>
@@ -0,0 +1,46 @@
1
+ describe('landmark-one-main test failure', function () {
2
+ 'use strict';
3
+ var results;
4
+ before(function (done) {
5
+ function start() {
6
+ axe.run({ runOnly: { type: 'rule', values: ['landmark-one-main'] } }, function (err, r) {
7
+ assert.isNull(err);
8
+ results = r;
9
+ done();
10
+ });
11
+ }
12
+ if (document.readyState !== 'complete') {
13
+ window.addEventListener('load', start);
14
+ } else {
15
+ start();
16
+ }
17
+ });
18
+
19
+ describe('violations', function () {
20
+ it('should find 1', function () {
21
+ assert.lengthOf(results.violations[0].nodes, 2);
22
+ });
23
+
24
+ it('should find #frame1', function () {
25
+ assert.deepEqual(results.violations[0].nodes[0].target, ['#fail1']);
26
+ });
27
+
28
+ it('should find #frame1, #violation2', function () {
29
+ assert.deepEqual(results.violations[0].nodes[1].target, ['#frame1', '#violation2']);
30
+ });
31
+ });
32
+
33
+ describe('passes', function () {
34
+ it('should find 0', function () {
35
+ assert.lengthOf(results.passes, 0);
36
+ });
37
+ });
38
+
39
+ it('should find 0 inapplicable', function () {
40
+ assert.lengthOf(results.inapplicable, 0);
41
+ });
42
+
43
+ it('should find 0 incomplete', function () {
44
+ assert.lengthOf(results.incomplete, 0);
45
+ });
46
+ });
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html lang="en" id="pass1">
3
+ <head>
4
+ <meta charset="utf8">
5
+ <link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" />
6
+ <script src="/node_modules/mocha/mocha.js"></script>
7
+ <script src="/node_modules/chai/chai.js"></script>
8
+ <script src="/axe.js"></script>
9
+ <script>
10
+ mocha.setup({
11
+ timeout: 10000,
12
+ ui: 'bdd'
13
+ });
14
+ var assert = chai.assert;
15
+ </script>
16
+ </head>
17
+ <body>
18
+ <p>No main content</p>
19
+ <iframe id="frame1" src="frames/level1.html"></iframe>
20
+ <div id="mocha"></div>
21
+ <script src="landmark-one-main-pass.js"></script>
22
+ <script src="/test/integration/adapter.js"></script>
23
+ </body>
24
+ </html>
@@ -0,0 +1,55 @@
1
+ describe('landmark-one-main test pass', function () {
2
+ 'use strict';
3
+ var results;
4
+ before(function (done) {
5
+ function start() {
6
+ axe.run({ runOnly: { type: 'rule', values: ['landmark-one-main'] } }, function (err, r) {
7
+ assert.isNull(err);
8
+ results = r;
9
+ done();
10
+ });
11
+ }
12
+ if (document.readyState !== 'complete') {
13
+ window.addEventListener('load', start);
14
+ } else {
15
+ start();
16
+ }
17
+ });
18
+
19
+ describe('violations', function () {
20
+ it('should find 0', function () {
21
+ assert.lengthOf(results.violations, 0);
22
+ });
23
+ });
24
+
25
+ describe('passes', function () {
26
+ it('should find 4', function () {
27
+ assert.lengthOf(results.passes[0].nodes, 4);
28
+ });
29
+
30
+ it('should find #pass1', function () {
31
+ assert.deepEqual(results.passes[0].nodes[0].target, ['#pass1']);
32
+ });
33
+
34
+ it('should find #frame1, #pass2', function () {
35
+ assert.deepEqual(results.passes[0].nodes[1].target, ['#frame1', '#pass2']);
36
+ });
37
+
38
+ it('should find #frame1, #frame2, #pass3', function () {
39
+ assert.deepEqual(results.passes[0].nodes[2].target, ['#frame1', '#frame2', '#pass3']);
40
+ });
41
+
42
+ it('should find #frame1, #frame3, #pass4', function () {
43
+ assert.deepEqual(results.passes[0].nodes[3].target, ['#frame1', '#frame3', '#pass4']);
44
+ });
45
+ });
46
+
47
+ it('should find 0 inapplicable', function () {
48
+ assert.lengthOf(results.inapplicable, 0);
49
+ });
50
+
51
+ it('should find 0 incomplete', function () {
52
+ assert.lengthOf(results.incomplete, 0);
53
+ });
54
+
55
+ });
@@ -25,6 +25,9 @@
25
25
  <li>Home</li>
26
26
  <li>Other</li>
27
27
  </ul>
28
+ <section>
29
+ <p>Content</p>
30
+ </section>
28
31
  <div id="mocha"></div>
29
32
  <script src="region-fail.js"></script>
30
33
  <script src="/test/integration/adapter.js"></script>
@@ -25,6 +25,16 @@
25
25
  <li>Home</li>
26
26
  <li>Other</li>
27
27
  </ul>
28
+ <section aria-labelledby="hdng">
29
+ <h1 id="hdng">Section heading</h1>
30
+ <p>Content</p>
31
+ </section>
32
+ <section aria-label="section 2">
33
+ <p>Content</p>
34
+ </section>
35
+ <section title="section 3">
36
+ <p>Content</p>
37
+ </section>
28
38
  <div id="mocha" role="complementary"></div>
29
39
  <script src="region-pass.js"></script>
30
40
  <script src="/test/integration/adapter.js"></script>
@@ -1,3 +1,5 @@
1
1
 
2
2
  <div role="alert" aria-selected="true" id="fail1">fail</div>
3
3
  <div role="link" aria-selected="true" id="fail2">fail</div>
4
+ <div role="row" aria-colcount="value" id="fail3">fail</div>
5
+ <div role="row" aria-rowcount="value" id="fail4">fail</div>
@@ -2,6 +2,6 @@
2
2
  "description": "aria-allowed-attr failing tests",
3
3
  "rule": "aria-allowed-attr",
4
4
  "violations": [
5
- ["#fail1"], ["#fail2"]
5
+ ["#fail1"], ["#fail2"], ["#fail3"], ["#fail4"]
6
6
  ]
7
- }
7
+ }
@@ -35,7 +35,7 @@
35
35
 
36
36
  <div role="form" id="pass17" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
37
37
 
38
- <div role="grid" id="pass18" aria-level="value" aria-multiselectable="value" aria-readonly="value" aria-activedescendant="value" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
38
+ <div role="grid" id="pass18" aria-level="value" aria-multiselectable="value" aria-readonly="value" aria-activedescendant="value" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value" aria-colcount="value" aria-rowcount="value">ok</div>
39
39
 
40
40
  <div role="gridcell" id="pass19" aria-colindex="value" aria-colspan="value" aria-rowindex="value" aria-rowspan="value" aria-selected="value" aria-readonly="value" aria-expanded="value" aria-required="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
41
41
 
@@ -65,7 +65,7 @@
65
65
 
66
66
  <div role="menubar" id="pass32" aria-activedescendant="value" aria-expanded="value" aria-orientation="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
67
67
 
68
- <div role="menuitem" id="pass33" aria-posinset="value" aria-setsize="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
68
+ <div role="menuitem" id="pass33" aria-posinset="value" aria-expanded="value" aria-setsize="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
69
69
 
70
70
  <div role="menuitemcheckbox" id="pass34" aria-checked="value" aria-posinset="value" aria-setsize="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
71
71
 
@@ -85,7 +85,7 @@
85
85
 
86
86
  <div role="region" id="pass42" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
87
87
 
88
- <div role="row" id="pass43" aria-colcount="value" aria-rowcount="value" aria-rowindex="value" aria-level="value" aria-selected="value" aria-activedescendant="value" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
88
+ <div role="row" id="pass43" aria-colindex="value" aria-rowindex="value" aria-level="value" aria-selected="value" aria-activedescendant="value" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
89
89
 
90
90
  <div role="rowgroup" id="pass44" aria-activedescendant="value" aria-expanded="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
91
91
 
@@ -136,3 +136,9 @@
136
136
  <div role="table" id="pass67" aria-colcount="value" aria-rowcount="value" aria-atomic="value" aria-busy="value" aria-controls="value" aria-describedby="value" aria-disabled="value" aria-dropeffect="value" aria-flowto="value" aria-grabbed="value" aria-haspopup="value" aria-hidden="value" aria-invalid="value" aria-keyshortcuts="value" aria-label="value" aria-labelledby="value" aria-live="value" aria-owns="value" aria-relevant="value">ok</div>
137
137
 
138
138
  <input type="reset" id="pass68" value="Reset" aria-pressed="true"/>
139
+
140
+ <input type="radio" aria-required="true" id="pass69" />
141
+ <div role="radio" aria-required="true" id="pass70">ok</div>
142
+
143
+ <input type="checkbox" aria-required="true" id="pass71" />
144
+ <div role="checkbox" aria-required="true" id="pass72">ok</div>
@@ -11,6 +11,7 @@
11
11
  ["#pass43"], ["#pass44"], ["#pass45"], ["#pass46"], ["#pass47"], ["#pass48"], ["#pass49"],
12
12
  ["#pass50"], ["#pass51"], ["#pass52"], ["#pass53"], ["#pass54"], ["#pass55"], ["#pass56"],
13
13
  ["#pass57"], ["#pass58"], ["#pass59"], ["#pass60"], ["#pass61"], ["#pass62"], ["#pass63"],
14
- ["#pass64"], ["#pass65"], ["#pass66"], ["#pass67"], ["#pass68"]
14
+ ["#pass64"], ["#pass65"], ["#pass66"], ["#pass67"], ["#pass68"], ["#pass69"], ["#pass70"],
15
+ ["#pass71"], ["#pass72"]
15
16
  ]
16
- }
17
+ }
@@ -40,6 +40,7 @@
40
40
  <div aria-valuemax="stuff" id="violation32">hi</div>
41
41
  <div aria-valuemin="stuff" id="violation33">hi</div>
42
42
  <div aria-valuenow="stuff" id="violation34">hi</div>
43
+ <div aria-errormessage="violation35-ref" id="violation35">hi</div><div id="violation35-ref"></div>
43
44
  </div>
44
45
  <h2>Possible False Positives</h2>
45
46
  <div>
@@ -245,6 +246,10 @@
245
246
  <div aria-valuenow="-.1" id="pass165">hi</div>
246
247
  <div aria-valuenow="-412" id="pass166">hi</div>
247
248
  <div aria-valuetext="stuff" id="pass167">hi</div>
249
+ <div aria-errormessage="pass168-ref" id="pass168">hi</div><div id="pass168-ref" role="alert"></div>
250
+ <div aria-errormessage="pass68" id="pass169">hi</div>
251
+ <div aria-errormessage="ref" aria-describedby="ref" id="pass170">hi</div>
252
+
248
253
 
249
254
  <div id="ref">Hi</div>
250
255
  <div id="ref2">Hi2</div>
@@ -7,7 +7,7 @@
7
7
  ["#violation12"], ["#violation13"], ["#violation14"], ["#violation15"], ["#violation16"], ["#violation17"],
8
8
  ["#violation18"], ["#violation19"], ["#violation20"], ["#violation21"], ["#violation22"], ["#violation23"],
9
9
  ["#violation24"], ["#violation25"], ["#violation26"], ["#violation27"], ["#violation28"], ["#violation29"],
10
- ["#violation30"], ["#violation31"], ["#violation32"], ["#violation33"], ["#violation34"]
10
+ ["#violation30"], ["#violation31"], ["#violation32"], ["#violation33"], ["#violation34"],["#violation35"]
11
11
  ],
12
12
  "passes": [
13
13
  ["#pass1"], ["#pass2"], ["#pass3"], ["#pass4"], ["#pass5"], ["#pass6"], ["#pass7"], ["#pass8"], ["#pass9"],
@@ -31,6 +31,7 @@
31
31
  ["#pass140"], ["#pass141"], ["#pass142"], ["#pass143"], ["#pass144"], ["#pass145"], ["#pass146"],
32
32
  ["#pass147"], ["#pass148"], ["#pass149"], ["#pass150"], ["#pass151"], ["#pass152"], ["#pass153"],
33
33
  ["#pass154"], ["#pass155"], ["#pass156"], ["#pass157"], ["#pass158"], ["#pass159"], ["#pass160"],
34
- ["#pass161"], ["#pass162"], ["#pass163"], ["#pass164"], ["#pass165"], ["#pass166"], ["#pass167"]
34
+ ["#pass161"], ["#pass162"], ["#pass163"], ["#pass164"], ["#pass165"], ["#pass166"], ["#pass167"],
35
+ ["#pass168"], ["#pass169"], ["#pass170"]
35
36
  ]
36
37
  }
@@ -8,11 +8,6 @@
8
8
  <div style="background-color: rgba(255, 255, 255, 0.1); color: white;" id="pass5">Pass.</div>
9
9
  </div>
10
10
 
11
- <label id="pass6">
12
- Default label
13
- <input type="text">
14
- </label>
15
-
16
11
  <div style="position:relative; height: 40px;">
17
12
  <label style="background-color:black; color: white;" id="pass7">
18
13
  Label
@@ -13,8 +13,6 @@
13
13
  ["#pass3"],
14
14
  ["#pass4"],
15
15
  ["#pass5"],
16
- ["#pass6"],
17
- ["#pass6 > input[type=\"text\"]"],
18
16
  ["#pass7"],
19
17
  ["#pass7 > input"]
20
18
  ],
@@ -25,6 +25,7 @@
25
25
  <body>
26
26
  <div id="mocha"></div>
27
27
  <div id="fixture"></div>
28
+ <script src="/test/testutils.js"></script>
28
29
 
29
30
  <script src="../../../tmp/integration-tests.js"></script>
30
31
 
@@ -130,7 +130,17 @@ describe('color-contrast-matches', function () {
130
130
  fixture.innerHTML = '<input type="text" disabled>';
131
131
  var target = fixture.querySelector('input');
132
132
  assert.isFalse(rule.matches(target));
133
+ });
133
134
 
135
+ it('should not match a disabled implicit label child', function () {
136
+ fixture.innerHTML = '<label>' +
137
+ '<input type="checkbox" style="position: absolute;display: inline-block;width: 1.5rem;height: 1.5rem;opacity: 0;" disabled checked>' +
138
+ '<span style="background-color:rgba(0, 0, 0, 0.26);display:inline-block;width: 1.5rem;height: 1.5rem;" aria-hidden="true"></span>' +
139
+ '<span style="color:rgba(0, 0, 0, 0.38);" id="target">Baseball</span>' +
140
+ '</label>';
141
+ var target = fixture.querySelector('#target');
142
+ var result = rule.matches(target);
143
+ assert.isFalse(result);
134
144
  });
135
145
 
136
146
  it('should not match <textarea disabled>', function () {
@@ -29,6 +29,7 @@
29
29
  <body>
30
30
  <div id="mocha"></div>
31
31
  <div id="fixture"></div>
32
+ <script src="/test/testutils.js"></script>
32
33
 
33
34
  <script src="aria-allowed-attr-matches.js"></script>
34
35
 
package/test/runner.tmpl CHANGED
@@ -25,6 +25,7 @@
25
25
  <body>
26
26
  <div id="mocha"></div>
27
27
  <div id="fixture"></div>
28
+ <script src="/test/testutils.js"></script>
28
29
  <% tests.forEach(function (file) { %>
29
30
  <script src="<%=file%>"></script>
30
31
  <% }); %>
@@ -0,0 +1,43 @@
1
+ var testUtils = {};
2
+
3
+ /**
4
+ * Create a check context for mocking/resetting data and relatedNodes in tests
5
+ *
6
+ * @return Object
7
+ */
8
+ testUtils.MockCheckContext = function () {
9
+ 'use strict';
10
+ return {
11
+ _relatedNodes: [],
12
+ _data: null,
13
+ data: function (d) {
14
+ this._data = d;
15
+ },
16
+ relatedNodes: function (rn) {
17
+ this._relatedNodes = rn;
18
+ },
19
+ reset: function () {
20
+ this._data = null;
21
+ this._relatedNodes = [];
22
+ }
23
+ };
24
+ };
25
+
26
+ /**
27
+ * Method for injecting content into a fixture
28
+ *
29
+ * @param Node|String Stuff to go into the fixture (html or DOM node)
30
+ * @return HTMLElement
31
+ */
32
+ testUtils.fixtureSetup = function (content) {
33
+ 'use strict';
34
+ var fixture = document.querySelector('#fixture');
35
+ if (typeof content === 'string') {
36
+ fixture.innerHTML = content;
37
+ } else if (content instanceof Node) {
38
+ fixture.appendChild(content);
39
+ }
40
+ return fixture;
41
+ };
42
+
43
+ axe.testUtils = testUtils;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- var axe = require('../../axe');
2
+ exports.__esModule = true;
3
+ var axe = require("../../axe");
3
4
  var context = document;
4
5
  var $fixture = {};
5
6
  axe.run(context, {}, function (error, results) {
@@ -15,6 +16,10 @@ axe.run(context, {}, function (error, results) {
15
16
  axe.run().then(function (done) {
16
17
  done();
17
18
  });
19
+ // additional configuration options
20
+ axe.run(context, { iframes: false, selectors: false, elementRef: false }, function (error, results) {
21
+ console.log(results.passes.length);
22
+ });
18
23
  // axe.a11yCheck config
19
24
  axe.a11yCheck(context, {}, function (results) {
20
25
  // axe's results object
@@ -28,6 +33,10 @@ axe.a11yCheck({ include: [['#id1'], ['#id2']] }, {}, function (results) {
28
33
  axe.a11yCheck({ exclude: [$fixture[0]] }, {}, function (results) {
29
34
  console.log(results);
30
35
  });
36
+ // additional configuration options
37
+ axe.a11yCheck(context, { iframes: false, selectors: false, elementRef: false }, function (results) {
38
+ console.log(results.passes.length);
39
+ });
31
40
  var tagConfigRunOnly = {
32
41
  type: 'tag',
33
42
  values: ['wcag2a']