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");
diff --git a/accname/name/ReadMe.md b/accname/name/ReadMe.md
new file mode 100644
index 00000000000000..be955258530b66
--- /dev/null
+++ b/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/accname/name/comp_embedded_control.html b/accname/name/comp_embedded_control.html
new file mode 100644
index 00000000000000..cfcd4d21c7bf5f
--- /dev/null
+++ b/accname/name/comp_embedded_control.html
@@ -0,0 +1,37 @@
+
+
+
+ Name Comp: Embedded Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_hidden_not_referenced.html b/accname/name/comp_hidden_not_referenced.html
new file mode 100644
index 00000000000000..cfaebbb502d91c
--- /dev/null
+++ b/accname/name/comp_hidden_not_referenced.html
@@ -0,0 +1,26 @@
+
+
+
+ Name Comp: Hidden Not Referenced
+
+
+
+
+
+
+
+
+
+
+ heading
+ bogus
+ label
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_host_language_label.html b/accname/name/comp_host_language_label.html
new file mode 100644
index 00000000000000..d2638b1ba75b74
--- /dev/null
+++ b/accname/name/comp_host_language_label.html
@@ -0,0 +1,30 @@
+
+
+
+ Name Comp: Host Language Label
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_label.html b/accname/name/comp_label.html
new file mode 100644
index 00000000000000..9edd8000e94995
--- /dev/null
+++ b/accname/name/comp_label.html
@@ -0,0 +1,22 @@
+
+
+
+ Name Comp: Label
+
+
+
+
+
+
+
+
+
+
x
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_labelledby.html b/accname/name/comp_labelledby.html
new file mode 100644
index 00000000000000..8e66362d81399f
--- /dev/null
+++ b/accname/name/comp_labelledby.html
@@ -0,0 +1,35 @@
+
+
+
+ Name Comp: Labelledby
+
+
+
+
+
+
+
+
+
+
+
div group label
+
text inside div group
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_name_from_content.html b/accname/name/comp_name_from_content.html
new file mode 100644
index 00000000000000..1390c6dcc80517
--- /dev/null
+++ b/accname/name/comp_name_from_content.html
@@ -0,0 +1,37 @@
+
+
+
+ Name Comp: Name From Content
+
+
+
+
+
+
+
+
+
+
label
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_text_node.html b/accname/name/comp_text_node.html
new file mode 100644
index 00000000000000..61f51cf4edc880
--- /dev/null
+++ b/accname/name/comp_text_node.html
@@ -0,0 +1,36 @@
+
+
+
+ Name Comp: Text Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ headinglabel
+
+
+
+
+ heading
+
+ label
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accname/name/comp_tooltip.html b/accname/name/comp_tooltip.html
new file mode 100644
index 00000000000000..52e7b43cfc54c8
--- /dev/null
+++ b/accname/name/comp_tooltip.html
@@ -0,0 +1,22 @@
+
+
+
+ Name Comp: Tooltip
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wai-aria/META.yml b/wai-aria/META.yml
index 25ab1c28495042..502b9c302510b3 100644
--- a/wai-aria/META.yml
+++ b/wai-aria/META.yml
@@ -1,6 +1,8 @@
spec: https://w3c.github.io/aria/
suggested_reviewers:
- cookiecrook
+ - spectranaut
+ - jnurthen
- halindrome
- joanmarie
- michael-n-cooper
diff --git a/wai-aria/scripts/aria-utils.js b/wai-aria/scripts/aria-utils.js
index 41d8535f91be4d..e6411a9a0eda23 100644
--- a/wai-aria/scripts/aria-utils.js
+++ b/wai-aria/scripts/aria-utils.js
@@ -5,8 +5,14 @@ const AriaUtils = {
/*
Tests simple role assignment:
x
Not intended for nested, context-dependent, or other complex role tests.
+
+ Ex: AriaUtils.assignAndVerifyRolesByRoleNames(["group", "main", "button"])
+
*/
assignAndVerifyRolesByRoleNames: function(roleNames) {
+ if (!Array.isArray(roleNames) || !roleNames.length) {
+ throw `Param roleNames of assignAndVerifyRolesByRoleNames("${roleNames}") should be an array containing at least one role string.`;
+ }
for (const role of roleNames) {
promise_test(async t => {
let el = document.createElement("div");
@@ -20,9 +26,10 @@ const AriaUtils = {
}
},
+
/*
- Tests computed role of all elements matching selector
- against the string value of their data-role attribute.
+ Tests computed ROLE of all elements matching selector
+ against the string value of their data-expectedrole attribute.
Ex:
{
const expectedRole = el.getAttribute("data-expectedrole");
@@ -57,5 +67,51 @@ const AriaUtils = {
}
},
+
+ /*
+ Tests computed LABEL of all elements matching selector
+ against the string value of their data-expectedlabel attribute.
+
+ Ex:
+
+ AriaUtils.verifyLabelsBySelector(".ex")
+
+ */
+ verifyLabelsBySelector: function(selector) {
+ const els = document.querySelectorAll(selector);
+ if (!els.length) {
+ throw `Selector passed in verifyLabelsBySelector("${selector}") should match at least one element.`;
+ }
+ for (const el of els) {
+ let label = el.getAttribute("data-expectedlabel");
+ let testName = el.getAttribute("data-testname") || label; // data-testname optional if label is unique per test file
+ promise_test(async t => {
+ const expectedLabel = el.getAttribute("data-expectedlabel");
+
+ // ensure ID existence and uniqueness for the webdriver callback
+ if (!el.id) {
+ let labelCount = 1;
+ let elID = `labelTest${labelCount}`;
+ while(document.getElementById(elID)) {
+ labelCount++;
+ elID = `labelTest${labelCount}`;
+ }
+ el.id = elID;
+ }
+
+ let computedLabel = await test_driver.get_computed_label(el);
+
+ // Todo: Remove whitespace normalization after https://github.com/w3c/accname/issues/192 is addressed. Change prior line back to `const`, too.
+ computedLabel = computedLabel.trim()
+
+ assert_equals(computedLabel, expectedLabel, el.outerHTML);
+ }, `${testName}`);
+ }
+ },
+
+
};