Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1 of accname name computation tests #39604

Merged
merged 9 commits into from
Apr 25, 2023
3 changes: 3 additions & 0 deletions accname/META.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
spec: https://w3c.github.io/accname/
suggested_reviewers:
- cookiecrook
- spectranaut
- jnurthen
- halindrome
- joanmarie
4 changes: 2 additions & 2 deletions accname/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ <h1 id="h">test heading</h1>

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('d'));
assert_true(label == "test label");
assert_equals(label, "test label");
}, "tests labelFrom: author");

promise_test(async t => {
const label = await test_driver.get_computed_label(document.getElementById('h'));
assert_true(label == "test heading");
assert_equals(label, "test heading");
}, "tests labelFrom: contents");

</script>
60 changes: 60 additions & 0 deletions accname/name/ReadMe.md
Original file line number Diff line number Diff line change
@@ -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



37 changes: 37 additions & 0 deletions accname/name/comp_embedded_control.html
Original file line number Diff line number Diff line change
@@ -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>
26 changes: 26 additions & 0 deletions accname/name/comp_hidden_not_referenced.html
Original file line number Diff line number Diff line change
@@ -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>
30 changes: 30 additions & 0 deletions accname/name/comp_host_language_label.html
Original file line number Diff line number Diff line change
@@ -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>
cookiecrook marked this conversation as resolved.
Show resolved Hide resolved
<!-- 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>
22 changes: 22 additions & 0 deletions accname/name/comp_label.html
Original file line number Diff line number Diff line change
@@ -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>
35 changes: 35 additions & 0 deletions accname/name/comp_labelledby.html
Original file line number Diff line number Diff line change
@@ -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>
37 changes: 37 additions & 0 deletions accname/name/comp_name_from_content.html
Original file line number Diff line number Diff line change
@@ -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>
36 changes: 36 additions & 0 deletions accname/name/comp_text_node.html
Original file line number Diff line number Diff line change
@@ -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>
cookiecrook marked this conversation as resolved.
Show resolved Hide resolved


<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>
22 changes: 22 additions & 0 deletions accname/name/comp_tooltip.html
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 2 additions & 0 deletions wai-aria/META.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
spec: https://w3c.github.io/aria/
suggested_reviewers:
- cookiecrook
- spectranaut
- jnurthen
- halindrome
- joanmarie
- michael-n-cooper
Loading