Skip to content

Commit

Permalink
fix: role=radio should not require aria-checked (#1448)
Browse files Browse the repository at this point in the history
* fix: role radio required state and props

* test: add more integration tests

* test: add  tests to allowed attr
  • Loading branch information
jeeyyy authored and WilcoFiers committed Apr 5, 2019
1 parent efaed91 commit 0643cbd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/commons/aria/index.js
Expand Up @@ -1550,9 +1550,9 @@ lookupTable.role = {
'aria-posinset',
'aria-setsize',
'aria-required',
'aria-errormessage'
],
required: ['aria-checked']
'aria-errormessage',
'aria-checked'
]
},
owned: null,
nameFrom: ['author', 'contents'],
Expand Down
1 change: 1 addition & 0 deletions test/checks/aria/allowed-attr.js
Expand Up @@ -109,6 +109,7 @@ describe('aria-allowed-attr', function() {
node.tabIndex = 1;
node.setAttribute('role', 'radio');
node.setAttribute('aria-required', 'true');
node.setAttribute('aria-checked', 'true');
fixture.appendChild(node);

assert.isTrue(
Expand Down
3 changes: 3 additions & 0 deletions test/integration/rules/aria-allowed-attr/passes.html
Expand Up @@ -145,3 +145,6 @@

<button id="pass73" aria-roledescription="attachment button"></button>
<input type="checkbox" aria-roledescription="cuisine type checkbox" id="pass74" />

<span role="radio" id="pass75" aria-checked="false">I am RED!</span>
<span role="radio" id="pass76" aria-checked="true">I am GREEN!</span>
4 changes: 3 additions & 1 deletion test/integration/rules/aria-allowed-attr/passes.json
Expand Up @@ -76,6 +76,8 @@
["#pass71"],
["#pass72"],
["#pass73"],
["#pass74"]
["#pass74"],
["#pass75"],
["#pass76"]
]
}
3 changes: 3 additions & 0 deletions test/integration/rules/aria-required-attr/required-attr.html
Expand Up @@ -3,6 +3,9 @@
<div role="spinbutton" id="pass3" aria-valuenow="value" aria-valuemax="value" aria-valuemin="value">ok</div>
<div role="heading" id="pass4" aria-level="1">ok</div>
<div role="combobox" id="pass5" aria-expanded="true">ok</div>
<span role="radio" id="pass6">I am BLUE!</span>
<span role="radio" id="pass7" aria-checked="false">I am RED!</span>
<span role="radio" id="pass8" aria-checked="true">I am GREEN!</span>

<div role="scrollbar" id="violation1">fail</div>
<div role="slider" id="violation2">fail</div>
Expand Down
11 changes: 10 additions & 1 deletion test/integration/rules/aria-required-attr/required-attr.json
Expand Up @@ -8,5 +8,14 @@
["#violation4"],
["#violation5"]
],
"passes": [["#pass1"], ["#pass2"], ["#pass3"], ["#pass4"], ["#pass5"]]
"passes": [
["#pass1"],
["#pass2"],
["#pass3"],
["#pass4"],
["#pass5"],
["#pass6"],
["#pass7"],
["#pass8"]
]
}

0 comments on commit 0643cbd

Please sign in to comment.