haikuwebkit/LayoutTests/accessibility/aria-labelledby-with-descen...

64 lines
3.2 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<div id="content">
<div class="ex" data-label="hello link use world test1 test2 test3" aria-labelledby="a1 b1" id="test1" role="group">group text</div>
<div id="a1">hello <a href="#">link</a> <div role="group">skip</div> <div role="group" aria-label="use">skip</div> world</div>
<!-- paragraph role is ambiguous so okay to leave next example as it -->
<div id="b1"><button>test1</button><p tabindex=0>test2 <span aria-hidden="true">hidden</span> test3</p></div>
<input type="checkbox" aria-labelledby="reverselabelfor" id="test2" class="ex" data-label="foo bar" data-note="labelled by label element">
<label id="reverselabelfor">foo <span role="text" aria-label="bar">skip</span></label>
<br>
<input type="checkbox" aria-labelledby="reverselabelforwithdiv" id="test3" class="ex" data-label="foo bar" data-note="labelled by div element">
<div id="reverselabelforwithdiv">foo <span role="text" aria-label="bar">skip</span></div>
<br>
<!-- would be "bar" natively, but label explicitly overridden to "foo" by labelledby -->
<div id="overridesnativelabel">foo</div><label for="nativelabeloverridden">bar</label>
<input class="ex" data-label="foo" id="test4" type="text" aria-labelledby="overridesnativelabel" data-note="overrides native label">
<!-- self-referencing labelledby in combination with external reference -->
<div id="productname1"><nav role="navigation"><!-- nav does not get nameFrom:contents -->product name</nav></div>
<button class="ex" data-label="Delete" aria-label="Delete" aria-labelledby="test5 productname1" id="test5" data-note="self-referencial labelledby includes nav">x</button>
<!-- self-referencing labelledby in combination with external reference -->
<div id="productname2"><nav role="heading"><!-- nav does not get nameFrom:contents, but heading does. -->product name</nav></div>
<button class="ex" data-label="Delete product name" aria-label="Delete" aria-labelledby="test6 productname2" id="test6" data-note="self-referencial labelledby includes heading">x</button>
<div class="ex" data-label="foo bar baz bop bap boom" aria-labelledby="a3 b3" id="test7" role="group" data-note="includes form elements">foo</div>
<button id="a3"> foo <img src="#" alt="bar"> baz</button>
<div id="b3">bop <input value="bap"> <input type="range" aria-valuetext="boom"></div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that if aria-labelledby is pointing to nodes with descendants, it returns all text.");
if (window.accessibilityController) {
for (var k = 1; k < 8; k++) {
var test = accessibilityController.accessibleElementById("test" + k);
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
debug("test " + k + ": aria-labelledby description: " + platformValueForW3CName(test));
debug("test " + k + ": expected description: " + document.getElementById("test" + k).getAttribute("data-label") + "\n");
}
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>