-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: Enable all rules by default, skip link change"
This reverts commit fe72739.
- Loading branch information
Marcy Sutton
committed
Dec 8, 2017
1 parent
fe72739
commit 6cec9fc
Showing
24 changed files
with
200 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": "href-no-hash", | ||
"evaluate": "href-no-hash.js", | ||
"metadata": { | ||
"impact": "moderate", | ||
"messages": { | ||
"pass": "Anchor does not have an href value of #", | ||
"fail": "Anchor has an href value of #" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
return [results[0]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
const target = axe.commons.dom.getElementByReference(node, 'href'); | ||
if (target) { | ||
return axe.commons.dom.isVisible(target, true) || undefined; | ||
} | ||
return false; | ||
return axe.commons.dom.isFocusable(axe.commons.dom.getElementByReference(node, 'href')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"id": "skip-link", | ||
"evaluate": "skip-link.js", | ||
"after": "skip-link-after.js", | ||
"metadata": { | ||
"impact": "moderate", | ||
"messages": { | ||
"pass": "Skip link target exists", | ||
"incomplete": "Skip link target should become visible on activation", | ||
"fail": "No skip link target" | ||
"pass": "Valid skip link found", | ||
"fail": "No valid skip link found" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ | |
"any": [ | ||
"hidden-content" | ||
], | ||
"none": [] | ||
"none": [], | ||
"enabled": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"id": "href-no-hash", | ||
"selector": "a[href]", | ||
"enabled": false, | ||
"tags": [ | ||
"cat.semantics", | ||
"best-practice" | ||
], | ||
"metadata": { | ||
"description": "Ensures that href values are valid link references to promote only using anchors as links", | ||
"help": "Anchors must only be used as links with valid URLs or URL fragments" | ||
}, | ||
"all": [], | ||
"any": [ | ||
"href-no-hash" | ||
], | ||
"none": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe('href-no-hash', function () { | ||
'use strict'; | ||
|
||
var fixture = document.getElementById('fixture'); | ||
|
||
afterEach(function () { | ||
fixture.innerHTML = ''; | ||
}); | ||
|
||
it('should return false if the href points to only hash', function () { | ||
fixture.innerHTML = '<a href="#">Click Here</a>'; | ||
var node = fixture.querySelector('a'); | ||
assert.isFalse(checks['href-no-hash'].evaluate(node)); | ||
}); | ||
|
||
it('should return true if the href points to hash plus id', function () { | ||
fixture.innerHTML = '<a href="#test">Click Here</a>'; | ||
var node = fixture.querySelector('a'); | ||
assert.isTrue(checks['href-no-hash'].evaluate(node)); | ||
}); | ||
|
||
it('should return true if the href is empty', function () { | ||
fixture.innerHTML = '<a href="">Click Here</a>'; | ||
var node = fixture.querySelector('a'); | ||
assert.isTrue(checks['href-no-hash'].evaluate(node)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Skip-Link Test</title> | ||
<link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" /> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script src="/axe.js"></script> | ||
<script> | ||
mocha.setup({ | ||
timeout: 10000, | ||
ui: 'bdd' | ||
}); | ||
var assert = chai.assert; | ||
</script> | ||
</head> | ||
<body> | ||
<p><a href="http://www.google.com" id="firstlink">This document is going to fail the skip-link test.</a></p> | ||
<div id="mocha"></div> | ||
<script src="skip-link-fail.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe('skip link fail test', function () { | ||
'use strict'; | ||
var results; | ||
before(function (done) { | ||
axe.run({ runOnly: { type: 'rule', values: ['skip-link'] } }, function (err, r) { | ||
assert.isNull(err); | ||
results = r; | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('violations', function () { | ||
it('should find one', function () { | ||
assert.lengthOf(results.violations[0].nodes, 1); | ||
}); | ||
|
||
it('should find html', function () { | ||
assert.deepEqual(results.violations[0].nodes[0].target, ['#firstlink']); | ||
}); | ||
}); | ||
|
||
describe('passes', function () { | ||
it('should find none', function () { | ||
assert.lengthOf(results.passes, 0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Skip-Link Test</title> | ||
<link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" /> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script src="/axe.js"></script> | ||
<script> | ||
mocha.setup({ | ||
timeout: 10000, | ||
ui: 'bdd' | ||
}); | ||
var assert = chai.assert; | ||
</script> | ||
</head> | ||
<body> | ||
<p><a href="#main" id="firstlink">This document is going to pass the skip-link test.</a></p> | ||
<h1 tabindex="0" id="main">Focusable header</h1> | ||
<div id="mocha"></div> | ||
<script src="skip-link-pass.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe('skip link pass test', function () { | ||
'use strict'; | ||
var results; | ||
before(function (done) { | ||
axe.run({ runOnly: { type: 'rule', values: ['skip-link'] } }, function (err, r) { | ||
assert.isNull(err); | ||
results = r; | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('passes', function () { | ||
it('should find one', function () { | ||
assert.lengthOf(results.passes[0].nodes, 1); | ||
}); | ||
|
||
it('should find html', function () { | ||
assert.deepEqual(results.passes[0].nodes[0].target, ['#firstlink']); | ||
}); | ||
}); | ||
|
||
describe('violations', function () { | ||
it('should find none', function () { | ||
assert.lengthOf(results.violations, 0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<a href="#" id="fail1">My anchor</a> | ||
|
||
<a href="#test" id="pass1">My anchor</a> | ||
|
||
<a href="" id="pass2">My anchor</a> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"description": "href-no-hash test", | ||
"rule": "href-no-hash", | ||
"violations": [["#fail1"]], | ||
"passes": [["#pass1"], ["#pass2"]] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.