From 0643cbd948f2bf3633bb048a531291c8e8a95967 Mon Sep 17 00:00:00 2001 From: Jey Date: Fri, 5 Apr 2019 12:36:16 +0100 Subject: [PATCH] fix: role=radio should not require aria-checked (#1448) * fix: role radio required state and props * test: add more integration tests * test: add tests to allowed attr --- lib/commons/aria/index.js | 6 +++--- test/checks/aria/allowed-attr.js | 1 + test/integration/rules/aria-allowed-attr/passes.html | 3 +++ test/integration/rules/aria-allowed-attr/passes.json | 4 +++- .../rules/aria-required-attr/required-attr.html | 3 +++ .../rules/aria-required-attr/required-attr.json | 11 ++++++++++- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/commons/aria/index.js b/lib/commons/aria/index.js index e8e12b2065..ab3fa350b2 100644 --- a/lib/commons/aria/index.js +++ b/lib/commons/aria/index.js @@ -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'], diff --git a/test/checks/aria/allowed-attr.js b/test/checks/aria/allowed-attr.js index 746e224fef..28b8bb5f71 100644 --- a/test/checks/aria/allowed-attr.js +++ b/test/checks/aria/allowed-attr.js @@ -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( diff --git a/test/integration/rules/aria-allowed-attr/passes.html b/test/integration/rules/aria-allowed-attr/passes.html index efa8207039..2af3795072 100644 --- a/test/integration/rules/aria-allowed-attr/passes.html +++ b/test/integration/rules/aria-allowed-attr/passes.html @@ -145,3 +145,6 @@ + +I am RED! +I am GREEN! diff --git a/test/integration/rules/aria-allowed-attr/passes.json b/test/integration/rules/aria-allowed-attr/passes.json index 8c4b057b05..1656ed13e9 100644 --- a/test/integration/rules/aria-allowed-attr/passes.json +++ b/test/integration/rules/aria-allowed-attr/passes.json @@ -76,6 +76,8 @@ ["#pass71"], ["#pass72"], ["#pass73"], - ["#pass74"] + ["#pass74"], + ["#pass75"], + ["#pass76"] ] } diff --git a/test/integration/rules/aria-required-attr/required-attr.html b/test/integration/rules/aria-required-attr/required-attr.html index d9338d9f8c..a431ed3442 100644 --- a/test/integration/rules/aria-required-attr/required-attr.html +++ b/test/integration/rules/aria-required-attr/required-attr.html @@ -3,6 +3,9 @@
ok
ok
ok
+I am BLUE! +I am RED! +I am GREEN!
fail
fail
diff --git a/test/integration/rules/aria-required-attr/required-attr.json b/test/integration/rules/aria-required-attr/required-attr.json index 3d65e3fcd7..d178ca90e3 100644 --- a/test/integration/rules/aria-required-attr/required-attr.json +++ b/test/integration/rules/aria-required-attr/required-attr.json @@ -8,5 +8,14 @@ ["#violation4"], ["#violation5"] ], - "passes": [["#pass1"], ["#pass2"], ["#pass3"], ["#pass4"], ["#pass5"]] + "passes": [ + ["#pass1"], + ["#pass2"], + ["#pass3"], + ["#pass4"], + ["#pass5"], + ["#pass6"], + ["#pass7"], + ["#pass8"] + ] }