diff options
Diffstat (limited to 'testing/web-platform/tests/accname/name')
11 files changed, 398 insertions, 0 deletions
diff --git a/testing/web-platform/tests/accname/name/ReadMe.md b/testing/web-platform/tests/accname/name/ReadMe.md new file mode 100644 index 0000000000..be95525853 --- /dev/null +++ b/testing/web-platform/tests/accname/name/ReadMe.md @@ -0,0 +1,60 @@ + +## Breakdown of AccName Name Computation files... + +Portions of the AccName algorithm are referenced via unique IDs such as `comp_labelledby` and `comp_embedded_control`. This ReadMe lists those sections (and subsections) in order as they appear in [AccName Computation Steps](https://w3c.github.io/accname/#computation-steps). + +In order to make the WPT test files digestible and understandable, the tests are broken up more or less in the structure of the algorithm, with the file struction listed below. Sub-section test (such as `comp_labelledby_recursion`) are tested as part of the main section `comp_labelledby` in [comp_labelledby.html](comp_labelledby.html). + +Non-name portions of the AccName spec (such as Descripton Computation) should be tested in another directory. + +If a new section of the AccName algorithm is added, please list it here when checking in new tests. Thanks. + +### No-Op (no test files) +- comp_init +- comp_computation + +### [comp_hidden_not_referenced](comp_hidden_not_referenced.html) + +### [comp_labelledby](comp_labelledby.html) + - comp_labelledby_reset + - comp_labelledby_foreach + - comp_labelledby_set_current + - comp_labelledby_recursion + - comp_labelledby_append + - comp_labelledby_return + +### [comp_embedded_control](comp_embedded_control.html) + - comp_embedded_control_textbox + - comp_embedded_control_combobox_or_listbox + - comp_embedded_control_range + - comp_embedded_control_range_valuetext + - comp_embedded_control_range_valuenow + - comp_embedded_control_range_host_language_value + +### [comp_label](comp_label.html) + +### [comp_host_language_label](comp_host_language_label.html) + +### [comp_name_from_content](comp_name_from_content.html) + - comp_name_from_content_reset + - comp_name_from_content_pseudo_element + - comp_name_from_content_pseudo_element_before + - comp_name_from_content_pseudo_element_after + - comp_name_from_content_for_each_child + - comp_name_from_content_for_each_child_set_current + - comp_name_from_content_for_each_child_recursion + - comp_for_each_child_append + - comp_name_from_content_return + +### [comp_text_node](comp_text_node.html) + +### comp_recursive_name_from_content (tested with [comp_name_from_content](comp_name_from_content.html)) + +### [comp_tooltip](comp_tooltip.html) + +### No-Op (no test files) + - comp_append + - comp_complete + + + diff --git a/testing/web-platform/tests/accname/name/comp_embedded_control.html b/testing/web-platform/tests/accname/name/comp_embedded_control.html new file mode 100644 index 0000000000..cfcd4d21c7 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_embedded_control.html @@ -0,0 +1,37 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Embedded Control</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> + +<label> + <input type="checkbox" data-expectedlabel="Flash the screen 3 times" data-testname="checkbox label with embedded textfield" class="ex"> + Flash the screen + <input value="3" aria-label="number of times" data-expectedlabel="number of times" data-testname="label of embedded textfield inside checkbox label" class="ex"> times +</label> + + +<!-- + +Todo: test all remaining cases of https://w3c.github.io/accname/#comp_embedded_control + - comp_embedded_control_textbox + - comp_embedded_control_combobox_or_listbox + - comp_embedded_control_range + - comp_embedded_control_range_valuetext + - comp_embedded_control_range_valuenow + - comp_embedded_control_range_host_language_value + +--> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_hidden_not_referenced.html b/testing/web-platform/tests/accname/name/comp_hidden_not_referenced.html new file mode 100644 index 0000000000..cfaebbb502 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_hidden_not_referenced.html @@ -0,0 +1,26 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Hidden Not Referenced</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> + +<h2 class="ex" data-expectedlabel="heading label" data-testname="heading with interior hidden node"> + heading + <span hidden>bogus</span> + label +</h2> + +<!-- Todo: test all remaining cases of https://w3c.github.io/accname/#comp_hidden_not_referenced --> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_host_language_label.html b/testing/web-platform/tests/accname/name/comp_host_language_label.html new file mode 100644 index 0000000000..d2638b1ba7 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_host_language_label.html @@ -0,0 +1,30 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Host Language Label</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> + +<label for="t">label</label> +<input id="t" data-expectedlabel="label" data-testname="host language: label[for] input[type=text]" class="ex"> +<!-- Todo: test all remaining input types with label[for] --> + +<label> + <input type="checkbox" data-expectedlabel="label" data-testname="host language: label input[type=checkbox] encapsulation" class="ex"> + label +</label> +<!-- Todo: test all remaining input types with label encapsulation --> + +<!-- Todo: test all remaining cases of https://w3c.github.io/accname/#comp_host_language_label --> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_label.html b/testing/web-platform/tests/accname/name/comp_label.html new file mode 100644 index 0000000000..9edd8000e9 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_label.html @@ -0,0 +1,22 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Label</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 aria-label="label" data-expectedlabel="label" data-testname="label valid on group" role="group" class="ex">x</div> + +<!-- Todo: test all remaining cases of https://w3c.github.io/accname/#comp_label --> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_labelledby.html b/testing/web-platform/tests/accname/name/comp_labelledby.html new file mode 100644 index 0000000000..8e66362d81 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_labelledby.html @@ -0,0 +1,35 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Labelledby</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="group" aria-labelledby="h" class="ex" data-expectedlabel="div group label" data-testname="div group explicitly labelledby heading"> + <h2 id="h">div group label</h2> + <p>text inside div group</p> +</div> + +<!-- + +Todo: test all remaining cases of https://w3c.github.io/accname/#comp_labelledby + - comp_labelledby_reset + - comp_labelledby_foreach + - comp_labelledby_set_current + - comp_labelledby_recursion + - comp_labelledby_append + - comp_labelledby_return + +--> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_name_from_content.html b/testing/web-platform/tests/accname/name/comp_name_from_content.html new file mode 100644 index 0000000000..1390c6dcc8 --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_name_from_content.html @@ -0,0 +1,37 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Name From Content</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> + +<h1 data-expectedlabel="label" data-testname="heading name from content" class="ex">label</h1> + +<!-- + +Todo: test all remaining cases of https://w3c.github.io/accname/#comp_name_from_content + - comp_name_from_content_reset + - comp_name_from_content_pseudo_element + - comp_name_from_content_pseudo_element_before + - comp_name_from_content_pseudo_element_after + - comp_name_from_content_for_each_child + - comp_name_from_content_for_each_child_set_current + - comp_name_from_content_for_each_child_recursion + - comp_for_each_child_append + - comp_name_from_content_return + +Todo: test all remaining *recursive* cases in https://w3c.github.io/accname/#comp_recursive_name_from_content + +--> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_text_node.html b/testing/web-platform/tests/accname/name/comp_text_node.html new file mode 100644 index 0000000000..61f51cf4ed --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_text_node.html @@ -0,0 +1,36 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Text Node</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> + +<!-- I'm not certain whether #comp_text_node requires a lot of testing outside of the #comp_name_from_content contexts, --> +<!-- but I did think of one example where text node versus comment node may make a difference when joining text nodes with a space vs innerText. --> + +<!-- Skipped (class="ex" removed) until https://github.com/w3c/accname/issues/193 is resolved --> +<h2 class="ex-skipped" data-expectedlabel="heading label" data-testname="heading with text/comment/text nodes, no space"> + heading<!-- with non-text node splitting concatenated text nodes -->label<!-- [sic] no extra spaces around first comment --> +</h2> + + +<h2 class="ex" data-expectedlabel="heading label" data-testname="heading with text/comment/text nodes, with space"> + heading + <!-- comment node between text nodes with leading/trailing whitespace --> + label +</h2> + + +<!-- Todo: test all remaining cases of https://w3c.github.io/accname/#comp_text_node --> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/comp_tooltip.html b/testing/web-platform/tests/accname/name/comp_tooltip.html new file mode 100644 index 0000000000..52e7b43cfc --- /dev/null +++ b/testing/web-platform/tests/accname/name/comp_tooltip.html @@ -0,0 +1,22 @@ +<!doctype html> +<html> +<head> + <title>Name Comp: Tooltip</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> + +<a href="#" title="label" data-expectedlabel="label" data-testname="link label from tooltip" class="ex"><img src="#" alt=""></a> + +<!-- Todo: test all remaining cases of https://w3c.github.io/accname/#comp_tooltip --> + +<script> +AriaUtils.verifyLabelsBySelector(".ex"); +</script> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/accname/name/shadowdom/basic.html b/testing/web-platform/tests/accname/name/shadowdom/basic.html new file mode 100644 index 0000000000..ca60986d33 --- /dev/null +++ b/testing/web-platform/tests/accname/name/shadowdom/basic.html @@ -0,0 +1,35 @@ +<!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> +<script src="/wai-aria/scripts/aria-utils.js"></script> + +<label id="label1"> + <div id="host1"></div> +</label> +<button id="labelled1" + class="labelled" + type="button" + aria-labelledby="label1" + data-expectedlabel="foo" + data-testname="aria-labelledby reference to element with text content inside shadow DOM"></button> + +<label id="label2"> + <div id="host2"></div> +</label> +<button id="labelled2" + class="labelled" + type="button" + aria-labelledby="label2" + data-expectedlabel="bar" + data-testname="aria-labelledby reference to element with aria-label inside shadow DOM"></button> +<script> + +document.getElementById('host1').attachShadow({ mode: 'open' }).innerHTML = 'foo'; +document.getElementById('host2').attachShadow({ mode: 'open' }).innerHTML = '<div aria-label="bar"></div>'; + +AriaUtils.verifyLabelsBySelector('.labelled'); + +</script> diff --git a/testing/web-platform/tests/accname/name/shadowdom/slot.html b/testing/web-platform/tests/accname/name/shadowdom/slot.html new file mode 100644 index 0000000000..9155a2eef3 --- /dev/null +++ b/testing/web-platform/tests/accname/name/shadowdom/slot.html @@ -0,0 +1,58 @@ +<!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> +<script src="/wai-aria/scripts/aria-utils.js"></script> + +<label id="label1"> + <div id="host1">slotted</div> +</label> +<button id="labelled1" + class="labelled" + type="button" + aria-labelledby="label1" + data-expectedlabel="foo slotted bar" + data-testname="aria-labelledby reference to element with slotted text content"></button> + +<label id="label2"> + <div id="host2"></div> +</label> +<button id="labelled2" + class="labelled" + type="button" + aria-labelledby="label2" + data-expectedlabel="foo default bar" + data-testname="aria-labelledby reference to element with default slotted text content"></button> + +<label id="label3"> + <div id="host3">slotted</div> +</label> +<button id="labelled3" + class="labelled" + type="button" + aria-labelledby="label3" + data-expectedlabel="foo slotted bar" + data-testname="aria-labelledby reference to element with slotted text content and aria-label on slot"></button> + +<label id="label4"> + <div id="host4"></div> +</label> +<button id="labelled4" + class="labelled" + type="button" + aria-labelledby="label4" + data-expectedlabel="foo default bar" + data-testname="aria-labelledby reference to element with default slotted text content and aria-label on slot"></button> + +<script> + +document.getElementById('host1').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot></slot> bar'; +document.getElementById('host2').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot>default</slot> bar'; +document.getElementById('host3').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label"></slot> bar'; +document.getElementById('host4').attachShadow({ mode: 'open' }).innerHTML = 'foo <slot aria-label="label">default</slot> bar'; + +AriaUtils.verifyLabelsBySelector('.labelled'); + +</script> |