-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(label,select-name): allow placeholder to pass label rule, add se…
…lect-name rule (#2448) * feat(label,select-name): allow placeholder to pass label rule, add select-name rule * add role none/presentation check * fix
- Loading branch information
Showing
16 changed files
with
355 additions
and
43 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,14 @@ | ||
{ | ||
"id": "non-empty-placeholder", | ||
"evaluate": "attr-non-space-content-evaluate", | ||
"options": { | ||
"attribute": "placeholder" | ||
}, | ||
"metadata": { | ||
"impact": "serious", | ||
"messages": { | ||
"pass": "Element has a placeholder attribute", | ||
"fail": "Element has no placeholder attribute or the placeholder attribute is empty" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"id": "select-name", | ||
"selector": "select", | ||
"tags": [ | ||
"cat.forms", | ||
"wcag2a", | ||
"wcag412", | ||
"wcag131", | ||
"section508", | ||
"section508.22.n" | ||
], | ||
"metadata": { | ||
"description": "Ensures select element has an accessible name", | ||
"help": "Select element must have and accessible name" | ||
}, | ||
"all": [], | ||
"any": [ | ||
"aria-label", | ||
"aria-labelledby", | ||
"implicit-label", | ||
"explicit-label", | ||
"non-empty-title", | ||
"role-none", | ||
"role-presentation" | ||
], | ||
"none": ["help-same-as-label", "hidden-explicit-label"] | ||
} |
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,37 @@ | ||
describe('non-empty-placeholder', function() { | ||
'use strict'; | ||
|
||
var fixture = document.getElementById('fixture'); | ||
var checkSetup = axe.testUtils.checkSetup; | ||
var checkEvaluate = axe.testUtils.getCheckEvaluate('non-empty-placeholder'); | ||
|
||
afterEach(function() { | ||
fixture.innerHTML = ''; | ||
}); | ||
|
||
it('should return true if a placeholder is present', function() { | ||
var params = checkSetup('<input id="target" placeholder="woohoo" />'); | ||
|
||
assert.isTrue(checkEvaluate.apply(null, params)); | ||
}); | ||
|
||
it('should return false if a placeholder is not present', function() { | ||
var params = checkSetup('<input id="target" />'); | ||
|
||
assert.isFalse(checkEvaluate.apply(null, params)); | ||
}); | ||
|
||
it('should return false if a placeholder is present, but empty', function() { | ||
var params = checkSetup('<input id="target" placeholder=" " />'); | ||
|
||
assert.isFalse(checkEvaluate.apply(null, params)); | ||
}); | ||
|
||
it('should collapse whitespace', function() { | ||
var params = checkSetup( | ||
'<input id="target" placeholder=" \t \n \r \t \t\r\n " />' | ||
); | ||
|
||
assert.isFalse(checkEvaluate.apply(null, params)); | ||
}); | ||
}); |
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 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,33 @@ | ||
<form action="#"> | ||
<select id="fail1"></select> | ||
<select aria-label="label" id="pass1"></select> | ||
<select aria-labelledby="label" id="pass2"></select> | ||
<div id="label">Label</div> | ||
<label> | ||
Label | ||
<select id="pass3"></select> | ||
</label> | ||
|
||
<label><select id="fail2"></select></label> | ||
<label for="fail3"> | ||
<select id="fail3"> | ||
<option>Thing</option> | ||
</select> | ||
</label> | ||
<label for="pass4">Label</label> | ||
<select id="pass4"></select> | ||
|
||
<select id="pass5" title="Label"></select> | ||
|
||
<select id="pass6" role="presentation"></select> | ||
<select id="pass7" role="none"></select> | ||
|
||
<div> | ||
<label> | ||
<select id="fail4"> | ||
<option selected="selected">Chosen</option> | ||
<option>Not Selected</option> | ||
</select> | ||
</label> | ||
</div> | ||
</form> |
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,14 @@ | ||
{ | ||
"description": "select-name test", | ||
"rule": "select-name", | ||
"violations": [["#fail1"], ["#fail2"], ["#fail3"], ["#fail4"]], | ||
"passes": [ | ||
["#pass1"], | ||
["#pass2"], | ||
["#pass3"], | ||
["#pass4"], | ||
["#pass5"], | ||
["#pass6"], | ||
["#pass7"] | ||
] | ||
} |
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
Oops, something went wrong.