diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/wai-aria/role | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/wai-aria/role')
7 files changed, 293 insertions, 0 deletions
diff --git a/testing/web-platform/tests/wai-aria/role/ReadMe.md b/testing/web-platform/tests/wai-aria/role/ReadMe.md new file mode 100644 index 0000000000..189c9f75eb --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/ReadMe.md @@ -0,0 +1,16 @@ + +# WPT Roles Tests + +/wai-aria/roles/ includes various files broken up by test type + +- **roles.html** covers simple assignment/verification of most core WAI-ARIA roles, and includes a list of cross-references to other specific files and spec directories. +- role testing of *host language* implicit roles (E.g., `<main> -> main`) are in other directories (E.g., [html-aam](https://github.com/web-platform-tests/interop-2023-accessibility-testing/issues/13)) +- role testing of **ARIA extension specs** are in other directories (E.g., [graphics-aria](https://github.com/web-platform-tests/interop-2023-accessibility-testing/issues/9)) +- basic.html was the first to ensure basic test coverage of webdriver getcomputedrole +- other context-dependent role tests, error handling, and edge cases are covered in separate files + - list-roles.html + - region-roles.html + - grid, listbox, menu, tree, etc + - fallback roles + - invalid roles + - error handling, etc. diff --git a/testing/web-platform/tests/wai-aria/role/basic.html b/testing/web-platform/tests/wai-aria/role/basic.html new file mode 100644 index 0000000000..5cb8386470 --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/basic.html @@ -0,0 +1,23 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> + +<div id='d' style='height: 100px; width: 100px' role="group" aria-label="test label"></div> +<h1 id="h">test heading</h1> +<script> + +promise_test(async t => { + const role = await test_driver.get_computed_role(document.getElementById('d')); + assert_equals(role, "group"); +}, "tests explicit role"); + + +promise_test(async t => { + const role = await test_driver.get_computed_role(document.getElementById('h')); + assert_equals(role, "heading"); +}, "tests implicit role"); + +</script> diff --git a/testing/web-platform/tests/wai-aria/role/list-roles.html b/testing/web-platform/tests/wai-aria/role/list-roles.html new file mode 100644 index 0000000000..5d9787f04b --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/list-roles.html @@ -0,0 +1,24 @@ +<!doctype html> +<html> +<head> + <title>List-related Role Verification Tests</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> + +<div role="list" data-testname="first simple list" data-expectedrole="list" class="ex"> + <div role="listitem" data-testname="first simple listitem" data-expectedrole="listitem" class="ex">x</div> + <div role="listitem" data-testname="last simple listitem" data-expectedrole="listitem" class="ex">x</div> +</div> + +<script> +AriaUtils.verifyRolesBySelector(".ex"); +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/wai-aria/role/region-roles.html b/testing/web-platform/tests/wai-aria/role/region-roles.html new file mode 100644 index 0000000000..d087f8f69b --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/region-roles.html @@ -0,0 +1,25 @@ +<!doctype html> +<html> +<head> + <title>Region Role Verification Tests</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> + +<!-- no label --> +<nav role="region" data-testname="region without label" data-expectedrole="navigation" class="ex">x</nav> + +<!-- w/ label --> +<nav role="region" data-testname="region with label" data-expectedrole="region" aria-label="x" class="ex">x</nav> + +<script> +AriaUtils.verifyRolesBySelector(".ex"); +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/wai-aria/role/role_none_conflict_resolution.html b/testing/web-platform/tests/wai-aria/role/role_none_conflict_resolution.html new file mode 100644 index 0000000000..efb247fc77 --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/role_none_conflict_resolution.html @@ -0,0 +1,37 @@ +<!doctype html> +<html> +<head> + <title>Role None Conflict Resolution Verification Tests</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> + +<p>Verifies <a href="https://w3c.github.io/aria/#conflict_resolution_presentation_none"></a>conflict resolution</a> requirements for the ARIA <a href="https://w3c.github.io/aria/#none">none</a> and <a href="https://w3c.github.io/aria/#presentation">presentation</a> roles.</p> + +<!-- none with label(global) on header --> +<h1 role="none" data-testname="heading role none with global attr aria-label" data-expectedrole="heading" aria-label="x" class="ex">x</h1> + +<!-- none with label(global) on paragraph --> +<p role="none" data-testname="p role none with global attr aria-label (prohibited role)" data-expectedrole="paragraph" aria-label="x" class="ex">x</p> +<p role="none" data-testname="p role none without global attr aria-label (prohibited role)" data-expectedrole="none" class="ex">x</p> + +<!-- none with focusable header --> +<h1 role="none" data-testname="focusable heading role none with tabindex=0" data-expectedrole="heading" tabindex="0" class="ex">x</h1> +<h1 role="none" data-testname="focusable heading role none with tabindex=-1" data-expectedrole="heading" tabindex="-1" class="ex">x</h1> +<h1 role="none" data-testname="non-focusable heading role none" data-expectedrole="none" class="ex">x</h1> + +<!-- none with non-global--> +<h1 role="none" data-testname="none with non-global" data-expectedrole="none" class="ex" aria-level="2"> Sample Content </h1> + + +<script> +AriaUtils.verifyRolesBySelector(".ex"); +</script> + +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/wai-aria/role/roles.html b/testing/web-platform/tests/wai-aria/role/roles.html new file mode 100644 index 0000000000..71946cbffa --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/roles.html @@ -0,0 +1,137 @@ +<!doctype html> +<html> +<head> + <title>Simple Core ARIA Role Verification Tests</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> +<script> + +/* + +Tests simple role assignment: <div role="alert">x</div> + +- Nested role structures (table>row>cell, etc) and + Abstract roles (e.g. widget, composite) are + commented with pointers to a separate test file. + +- ARIA extension specs (e.g. doc-*, graphics-*) are + commented with pointers to a separate spec directory. + +*/ + +AriaUtils.assignAndVerifyRolesByRoleNames([ + "alert", + "alertdialog", + "application", + "article", + // "associationlist" [AT-RISK: ARIA #1662] or possibly -> ./list-roles.html + // "associationlistitemkey" [AT-RISK: ARIA #1662] or possibly -> ./list-roles.html + // "associationlistitemvalue" [AT-RISK: ARIA #1662] or possibly -> ./list-roles.html + "banner", + "blockquote", + "button", + "caption", + // "cell" -> ./grid-roles.html + "checkbox", + "code", + // "columnheader" -> ./grid-roles.html + "combobox", + // "command" -> ./abstract-roles.html + // "comment" -> [AT-RISK: ARIA #1885] + "complementary", + // "composite" -> ./abstract-roles.html + "contentinfo", + "definition", + "deletion", + "dialog", + // "directory" -> FAIL. WONTFIX. Deprecated in ARIA 1.2; re-mapped to list role. + "document", + // doc-* roles -> TBD /dpub-aria or /dpub-aam + "emphasis", + "feed", + "figure", + "form", + "generic", + // graphics-* roles -> /graphics-aria + // "grid" -> ./grid-roles.html + // "gridcell" -> ./grid-roles.html + "group", + "heading", + // "image" -> ./synonym-roles.html + // "img" -> ./synonym-roles.html + // "input" -> ./abstract-roles.html + "insertion", + // "landmark" -> ./abstract-roles.html + "link", + // "list" -> ./list-roles.html + // "listitem" -> ./list-roles.html + // "listitemkey" [See: ARIA #1662] or possibly -> ./list-roles.html + // "listitemvalue" [See: ARIA #1662] or possibly -> ./list-roles.html + // "listbox" -> ./listbox-roles.html + "log", + "main", + "marquee", + "math", + // "menu" -> ./menu-roles.html + // "menuitem" -> ./menu-roles.html + // "menuitemcheckbox" -> ./menu-roles.html + // "menuitemradio" -> ./menu-roles.html + // "menubar" -> ./menu-roles.html + "meter", + "navigation", + // "none" -> ./synonym-roles.html + "note", + // "option" -> ./listbox-roles.html + "paragraph", + // "presentation" -> ./synonym-roles.html + "progressbar", + "radio", + "radiogroup", + // "range" -> ./abstract-roles.html + // "region" -> ./region-roles.html + // "roletype" -> ./abstract-roles.html + // "row" -> ./grid-roles.html + // "rowgroup" -> ./grid-roles.html + // "rowheader" -> ./grid-roles.html + "scrollbar", + "search", + "searchbox", + // "section" -> ./abstract-roles.html + // "sectionhead" -> ./abstract-roles.html + // "select" -> ./abstract-roles.html + "separator", + "slider", + "spinbutton", + "status", + "strong", + // "structure" -> ./abstract-roles.html + "subscript", + "suggestion", + "superscript", + "switch", + // "tab" -> ./tab-roles.html + // "table" -> ./grid-roles.html + // "tablist" -> ./tab-roles.html + // "tabpanel" -> ./tab-roles.html + "term", + "textbox", + "time", + "timer", + "toolbar", + "tooltip", + // "tree" -> ./tree-roles.html + // "treeitem" -> ./tree-roles.html + // "treegrid" -> ./treegrid-roles.html + // "widget" -> ./abstract-roles.html + // "window" -> ./abstract-roles.html +]); + +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/wai-aria/role/synonym-roles.html b/testing/web-platform/tests/wai-aria/role/synonym-roles.html new file mode 100644 index 0000000000..59d913a60a --- /dev/null +++ b/testing/web-platform/tests/wai-aria/role/synonym-roles.html @@ -0,0 +1,31 @@ +<!doctype html> +<html> +<head> + <title>Region Role Verification Tests</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> + +<!-- spec resolution https://github.com/w3c/core-aam/issues/166 --> + +<div role="none" id="none" data-expectedrole="none" data-testname="none role == computedrole none" class="ex">x</div><!-- preferred --> +<div role="presentation" id="presentation" data-expectedrole="none" data-testname="synonym presentation role == computedrole none" class="ex">x</div><!-- synonym --> + +<div role="image" id="image" data-expectedrole="image" data-testname="image role == computedrole image" class="ex">x</div><!-- preferred --> +<div role="img" id="img" data-expectedrole="image" data-testname="synonym img role == computedrole image" class="ex">x</div><!-- synonym --> + +<!-- `directory` synonym deprecated in ARIA 1.2; these examples should all return computedrole `list` --> +<ul role="list" id="list2" data-expectedrole="list" data-testname="list role == computedrole list" class="ex"><li>x</li></ul> +<ul role="directory" id="directory" data-expectedrole="list" data-testname="directory role == computedrole list" class="ex"><li>x</li></ul> +<div role="directory" id="div" data-expectedrole="list" data-testname="div w/directory role == computedrole list" class="ex"><div role="listitem">x</div></div> + +<script> +AriaUtils.verifyRolesBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file |