Skip to content

Commit

Permalink
Bug 1859024 [wpt PR 42013] - Update wai-aria/role/invalid-roles.html,…
Browse files Browse the repository at this point in the history
… a=testonly

Automatic update from web-platform-tests
Update wai-aria/role/invalid-roles.html (#42013)

Authored-by: Rahim Abdi <[email protected]>

AccName invalid roles tests from web-platform-tests/interop-accessibility#19
--

wpt-commits: 8be1d22ad586928f1db503cd76d018bf6848811f
wpt-pr: 42013
  • Loading branch information
rahimabdi authored and moz-wptsync-bot committed Oct 26, 2023
1 parent a768249 commit adff00f
Showing 1 changed file with 111 additions and 13 deletions.
124 changes: 111 additions & 13 deletions testing/web-platform/tests/wai-aria/role/invalid-roles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,127 @@
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/wai-aria/scripts/aria-utils.js"></script>
<meta charset="utf-8">
</head>
<body>

<p>Verifies Invalid Roles from <a href="https://w3c.github.io/aria/#document-handling_author-errors_roles">9.1 Roles - handling author errors</a></p>
<p>Tests invalid ARIA roles from <a href="https://w3c.github.io/aria/#document-handling_author-errors_roles">9.1 Roles - handling author errors</a>.</p>

<nav role="foo" data-testname="invalid role name foo" data-expectedrole="navigation" class="ex">x</nav>
<nav role="foo bar" data-testname="multiple invalid role names" data-expectedrole="navigation" class="ex">x</nav>
<!-- Tests fallback for <nav> when 1/2/3 invalid roles are supplied -->
<nav role="foo" data-testname="nav with invalid role name foo" data-expectedrole="navigation" class="ex">x</nav>
<nav role="foo bar" data-testname="nav with two invalid role names" data-expectedrole="navigation" class="ex">x</nav>
<nav role="foo bar baz" data-testname="nav with three invalid role names" data-expectedrole="navigation" class="ex">x</nav>

<!-- todo: additional invalid roles:
<!-- Tests fallback for <button> when 1/2/3 invalid roles are supplied -->
<button role="foo" data-testname="button with invalid role name foo" data-expectedrole="button" class="ex">x</button>
<button role="foo bar" data-testname="button with two invalid role names" data-expectedrole="button" class="ex">x</button>
<button role="foo bar baz" data-testname="button with three invalid role names" data-expectedrole="button" class="ex">x</button>

- whitespace tests (including line breaks, tabs, zero-width space, braille space)
- diacritics
- zero-width joiners (e.g. ZWJ like emoji variants use)
- non-western chars
- RTL strings (Hebrew & Arabic)
- escaped chars, URL-encoded chars
- backslash closing quote and other obvious hack attempts
- etc.
<!-- Tests fallback for semantically neutral elements when 1/2/3 invalid roles are supplied -->
<span role="foo" data-testname="span with invalid role name foo" class="ex-generic">x</span>
<span role="foo bar" data-testname="span with two invalid role names" class="ex-generic">x</span>
<span role="foo bar baz" data-testname="span with three invalid role names" class="ex-generic">x</span>
<div role="foo" data-testname="div with invalid role name foo" class="ex-generic">x</div>
<div role="foo bar" data-testname="div with two invalid role names" class="ex-generic">x</div>
<div role="foo bar baz" data-testname="div with three invalid role names"class="ex-generic">x</div>

-->
<!-- Whitespace tests with <nav> (including line breaks, tabs, zero-width space, braille space, non-breaking space, standard space) -->
<nav role=" " data-testname="nav with empty character as role" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#13" data-testname="nav with line break (&#13) character as role" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#9" data-testname="nav with tab (&#9) as role (should be treated as whitespace)" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#8203" data-testname="nav with zero-width space as role (should be treated as whitespace)" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#10240" data-testname="nav with braille space (10240) as role" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#x2800" data-testname="nav with braille space (x2800) as role" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&nbsp" data-testname="nav with non-breaking space (nbsp) as role" data-expectedrole="navigation" class="ex">x</nav>
<nav role="&#20" data-testname="nav with standard space (nbsp) as role" data-expectedrole="navigation" class="ex">x</nav>

<!-- Escaped whitespace tests with <span> (including line breaks, tabs, zero-width space, braille space, non-breaking space, standard space) -->
<span role=" " data-testname="span with escaped empty character as role" class="ex-generic">x</span>
<span role="&#13" data-testname="span with escaped line break (&#13) character as role" class="ex-generic">x</span>
<span role="&#9" data-testname="span with escaped tab (&#9) as role (should be treated as whitespace)" class="ex-generic">x</span>
<span role="&#8203" data-testname="span with escaped zero-width space as role (should be treated as whitespace)" class="ex-generic">x</span>
<span role="&#10240" data-testname="span with escaped braille space (10240) as role" class="ex-generic">x</span>
<span role="&#x2800" data-testname="span with escaped braille space (x2800) as role" class="ex-generic">x</span>
<span role="&nbsp" data-testname="span with escaped non-breaking space (nbsp) as role" class="ex-generic">x</span>
<span role="&#20" data-testname="span with escaped standard space (nbsp) as role" class="ex-generic">x</span>

<!-- Unescaped whitespace tests with <span> (including line breaks, tabs, zero-width space, braille space, non-breaking space, standard space) -->
<span role=" " data-testname="span with empty character as role" class="ex-generic">x</span>
<span role="
" data-testname="span with line break (&#13) character as role" class="ex-generic">x</span>
<span role=" " data-testname="span with tab (&#9) as role (should be treated as whitespace)" class="ex-generic">x</span>
<span role="" data-testname="span with zero-width space as role (should be treated as whitespace)" class="ex-generic">x</span>
<span role="" data-testname="span with braille space (10240) as role" class="ex-generic">x</span>
<span role=" " data-testname="span with non-breaking space (nbsp) as role" class="ex-generic">x</span>
<span role=" " data-testname="span with standard space as role" class="ex-generic">x</span>

<!-- Diacritics with <a> -->
<a href="#" role="&#771" data-testname="link with role set to tilde diacritic" data-expectedrole="link" class="ex">x</a>
<a href="#" role="foo&#771" data-testname="link with role foo that has tilde diacritic" data-expectedrole="link" class="ex">x</a>
<a href="#" role="&#773" data-testname="link with role set to overline diacritic" data-expectedrole="link" class="ex">x</a>
<a href="#" role="foo&#773" data-testname="link with role foo that has overline diacritic" data-expectedrole="link" class="ex">x</a>
<a href="#" role="&#813" data-testname="link with role set to circumflex diacritic below" data-expectedrole="link" class="ex">x</a>
<a href="#" role="foo&#813" data-testname="link with role foo that has circumflex diacritic below" data-expectedrole="link" class="ex">x</a>
<a href="#" role="button&#771" data-testname="link with role set to button with tilde diacritic" data-expectedrole="link" class="ex">x</a>

<!-- Diacritics with <div> -->
<div role="&#771" data-testname="div with role set to tilde diacritic" class="ex-generic">x</div>
<div role="foo&#771" data-testname="div with role foo that has tilde diacritic" class="ex-generic">x</div>
<div role="button&#771" data-testname="div with role set to button with tilde diacritic" class="ex-generic">x</div>
<div role="button´" data-testname="div with role set to button with unescaped tilde diacritic" class="ex-generic">x</div>

<!-- Zero-width joiners (e.g., ZWJ like emoji variants use) with <button> -->
<!-- [sic] role="‍" should include an invisible ZWJ], and role="link‍" ends with an invisible ZWJ. Use caution when editing. -->
<button role="" data-testname="button with role set to zero-width joiner" data-expectedrole="button" class="ex">x</button>
<button role="link‍" data-testname="button with role set to foo with zero-width joiner" data-expectedrole="button" class="ex">x</button>

<!-- Non-western chars with <nav> -->
<nav role="Θ" data-testname="nav with role set to theta (Θ)" data-expectedrole="navigation" class="ex">x</nav>
<nav role="ژ" data-testname="nav with role set to Persian character (ژ)" data-expectedrole="navigation" class="ex">x</nav>
<nav role="ژ ♮" data-testname="nav with multiple non-latin character roles, Persian character (ژ) and ♮" data-expectedrole="navigation" class="ex">x</nav>
<nav role="漢字" data-testname="nav with role set to Japanese kanji" data-expectedrole="navigation" class="ex">x</nav>

<!-- Non-western chars with <span> -->
<span role="Θ" data-testname="span with role set to theta (Θ)" class="ex-generic">x</span>
<span role="ژ" data-testname="span with role set to Persian character (ژ)" class="ex-generic">x</span>
<span role="ژ ♮" data-testname="span with multiple non-latin character roles, Persian character (ژ) and ♮" class="ex-generic">x</span>
<span role="漢字" data-testname="span with role set to Japanese kanji" class="ex-generic">x</span>

<!-- RTL strings (Hebrew & Arabic) with <nav> -->
<nav role="سلام" data-testname="nav with role set to Arabic text" data-expectedrole="navigation" class="ex">x</nav>
<nav role="سلام حبيب" data-testname="nav with multiple role assignments set to Arabic text" data-expectedrole="navigation" class="ex">x</nav>
<nav role="שלום" data-testname="nav with role set to Hebrew text" data-expectedrole="navigation" class="ex">x</nav>
<nav role="שלום חבר" data-testname="nav with multiple role assignments set to Hebrew text" data-expectedrole="navigation" class="ex">x</nav>

<!-- RTL strings (Hebrew & Arabic) with <div> -->
<div role="سلام" data-testname="div with role set to Arabic text" class="ex-generic">x</div>
<div role="سلام حبيب" data-testname="div with multiple role assignments set to Arabic text" class="ex-generic">x</div>
<div role="שלום" data-testname="div with role set to Hebrew text" class="ex-generic">x</div>
<div role="שלום חבר" data-testname="div with multiple role assignments set to Hebrew text" class="ex-generic">x</div>

<!-- Escaped chars, URL-encoded chars with <a> -->
<a href="https://www.apple.com/" role="&amp" data-testname="link with role set to ampersand character" data-expectedrole="link" class="ex">x</a>
<a href="https://www.apple.com/" role="&lt" data-testname="link with role set to less than angle bracket character" data-expectedrole="link" class="ex">x</a>

<!-- Escaped chars, URL-encoded chars with <span> -->
<span role="&amp" data-testname="span with role set to ampersand character" class="ex-generic">x</span>
<span role="&lt" data-testname="span with role set to less than angle bracket character" class="ex-generic">x</span>
<span role="&" data-testname="span with role set to unescaped ampersand character" class="ex-generic">x</span>
<span role="<" data-testname="span with role set to unescaped less than angle bracket character" class="ex-generic">x</span>

<!-- Backslash closing quote and other malformed roles with characters with <nav> -->
<nav role="region\" data-testname="nav with role set to region followed by backslash" data-expectedrole="navigation" class="ex">x</nav>
<nav role="\region" data-testname="nav with role set to backslash followed by region" data-expectedrole="navigation" class="ex">x</nav>
<nav role="re/gion" data-testname="nav with role set to region with backslash after e character" data-expectedrole="navigation" class="ex">x</nav>

<!-- Backslash closing quote and other malformed roles with characters with <span> -->
<span role="region\" data-testname="span with role set to region followed by backslash" class="ex-generic">x</span>
<span role="\region" data-testname="span with role set to backslash followed by region" class="ex-generic">x</span>
<span role="re/gion" data-testname="span with role set to region with forward slash after e character" class="ex-generic">x</span>

<script>
AriaUtils.verifyRolesBySelector(".ex");
AriaUtils.verifyGenericRolesBySelector(".ex-generic");
</script>

</body>
Expand Down

0 comments on commit adff00f

Please sign in to comment.