diff --git a/lib/checks/keyboard/page-has-heading-one.json b/lib/checks/keyboard/page-has-heading-one.json index 1be1594661..778b8ce21a 100644 --- a/lib/checks/keyboard/page-has-heading-one.json +++ b/lib/checks/keyboard/page-has-heading-one.json @@ -3,7 +3,7 @@ "evaluate": "has-descendant-evaluate", "after": "has-descendant-after", "options": { - "selector": "h1:not([role]), [role=heading][aria-level=1]" + "selector": "h1:not([role]):not([aria-level]), h1:not([role])[aria-level=1], h2:not([role])[aria-level=1], h3:not([role])[aria-level=1], h4:not([role])[aria-level=1], h5:not([role])[aria-level=1], h6:not([role])[aria-level=1], [role=heading][aria-level=1]" }, "metadata": { "impact": "moderate", diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-fail.html b/test/integration/full/page-has-heading-one/page-has-heading-one-fail.html index 08185a0bdd..81f22e9c26 100644 --- a/test/integration/full/page-has-heading-one/page-has-heading-one-fail.html +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-fail.html @@ -20,6 +20,9 @@

No h1 here

+

Hello!

+

Goodbye

+

Error

diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass1.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass1.js index d9075a825d..9c211040c0 100644 --- a/test/integration/full/page-has-heading-one/page-has-heading-one-pass1.js +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass1.js @@ -1,4 +1,4 @@ -describe('page-has-heading-one test pass', function() { +describe('page-has-heading-one test pass 1', function() { 'use strict'; var results; before(function(done) { diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass2.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass2.html index 30c57dbefb..b28a132fde 100644 --- a/test/integration/full/page-has-heading-one/page-has-heading-one-pass2.html +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass2.html @@ -1,5 +1,5 @@ - + - + + + + + + + + + + + +

Level one heading!

+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass4.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass4.js new file mode 100644 index 0000000000..324159e5ea --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass4.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 4', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass4', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass4']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +}); diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.html new file mode 100644 index 0000000000..912aae4ca9 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +

Level one heading!

+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.js new file mode 100644 index 0000000000..c902620df6 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass5.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 5', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass5', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass5']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +}); diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.html new file mode 100644 index 0000000000..0a86386b24 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +

Level one heading!

+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.js new file mode 100644 index 0000000000..c2509b9e92 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass6.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 6', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass6', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass6']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +}); diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.html new file mode 100644 index 0000000000..bb6f16ac9a --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +
Level one heading!
+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.js new file mode 100644 index 0000000000..1a2a707d6c --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass7.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 7', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass7', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass7']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +}); diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.html new file mode 100644 index 0000000000..f3f4e6490e --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +
Level one heading!
+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.js new file mode 100644 index 0000000000..414fa4fa08 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass8.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 8', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass8', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass8']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +}); diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.html b/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.html new file mode 100644 index 0000000000..5927dd1e22 --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +

Level one heading!

+
+ + + + + diff --git a/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.js b/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.js new file mode 100644 index 0000000000..25d6313d6c --- /dev/null +++ b/test/integration/full/page-has-heading-one/page-has-heading-one-pass9.js @@ -0,0 +1,46 @@ +describe('page-has-heading-one test pass 9', function() { + 'use strict'; + var results; + before(function(done) { + axe.testUtils.awaitNestedLoad(function() { + // Stop messing with my tests Mocha! + var heading = document.querySelector('#mocha h1'); + if (heading) { + heading.outerHTML = '

page-has-heading-one test

'; + } + + axe.run( + { runOnly: { type: 'rule', values: ['page-has-heading-one'] } }, + function(err, r) { + assert.isNull(err); + results = r; + done(); + } + ); + }); + }); + + describe('violations', function() { + it('should find 0', function() { + assert.lengthOf(results.violations, 0); + }); + }); + + describe('passes', function() { + it('should find 1', function() { + assert.lengthOf(results.passes[0].nodes, 1); + }); + + it('should find #pass9', function() { + assert.deepEqual(results.passes[0].nodes[0].target, ['#pass9']); + }); + }); + + it('should find 0 inapplicable', function() { + assert.lengthOf(results.inapplicable, 0); + }); + + it('should find 0 incomplete', function() { + assert.lengthOf(results.incomplete, 0); + }); +});