Skip to content
Permalink
Browse files
AX: Layout tests related to text alternative computation need to be d…
…one 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
  • Loading branch information
joanmarie committed May 20, 2016
1 parent f0e72b3 commit f18a4f06c3af25eda9c5e5160a663b8f1dfda1aa
Showing 80 changed files with 447 additions and 682 deletions.
@@ -1,3 +1,120 @@
2016-05-20 Joanmarie Diggs <jdiggs@igalia.com>

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.

2016-05-19 Myles C. Maxfield <mmaxfield@apple.com>

Test gardening after r201203
@@ -1,12 +1,12 @@

This tests that setting a role on an img still allows the alt attribute to be used for the description..
This tests the alternative text calculation when setting a role on an img with an alt attribute.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS text.stringValue is 'AXValue: TEST1'
PASS group.description is 'AXDescription: TEST2'
PASS button.description is 'AXDescription: TEST3'
PASS platformValueForW3CName(group) is "TEST2"
PASS platformValueForW3CName(button) is "TEST3"
PASS successfullyParsed is true

TEST COMPLETE
@@ -2,6 +2,7 @@
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">

@@ -16,7 +17,7 @@

<script>

description("This tests that setting a role on an img still allows the alt attribute to be used for the description..");
description("This tests the alternative text calculation when setting a role on an img with an alt attribute.");

if (window.accessibilityController) {

@@ -26,13 +27,8 @@
var group = accessibilityController.accessibleElementById("group");
var button = accessibilityController.accessibleElementById("button");

if (accessibilityController.platformName == "atk") {
shouldBe("group.title", "'AXTitle: TEST2'");
shouldBe("button.title", "'AXTitle: TEST3'");
} else {
shouldBe("group.description", "'AXDescription: TEST2'");
shouldBe("button.description", "'AXDescription: TEST3'");
}
shouldBeEqualToString("platformValueForW3CName(group)", "TEST2");
shouldBeEqualToString("platformValueForW3CName(button)", "TEST3");
}

</script>
@@ -1,10 +1,10 @@
button
This tests that aria-help attribute works as expected.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS button.helpText is 'AXHelp: click here'
PASS platformValueForW3CName(axButton) is "title"
PASS platformValueForW3CDescription(axButton) is "click here"
PASS successfullyParsed is true

TEST COMPLETE
@@ -2,13 +2,14 @@
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">

<div id="content">
<div id="button" tabindex=0 role="button" aria-label="title" aria-help="click here">
button
</div>

</div>
<p id="description"></p>
<div id="console"></div>

@@ -17,15 +18,13 @@
description("This tests that aria-help attribute works as expected.");

if (window.accessibilityController) {

document.getElementById("button").focus();
var button = accessibilityController.focusedElement;
if (accessibilityController.platformName == "atk")
shouldBe("button.description", "'AXDescription: click here'");
else
shouldBe("button.helpText", "'AXHelp: click here'");
}
var axButton = accessibilityController.focusedElement;
shouldBeEqualToString("platformValueForW3CName(axButton)", "title");
shouldBeEqualToString("platformValueForW3CDescription(axButton)", "click here");

document.getElementById("content").style.visibility = "hidden";
}
</script>

<script src="../resources/js-test-post.js"></script>
@@ -1,11 +1,10 @@
test
This tests that the aria-label attribute works. The input and the A tag should return the appropriate description.
This tests that the aria-label attribute works on both an input and an anchor.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS succeeded is true
PASS succeeded is true
PASS platformValueForW3CName(axInput) is "aria label"
PASS platformValueForW3CName(axLink) is "aria link"
PASS successfullyParsed is true

TEST COMPLETE
@@ -2,37 +2,33 @@
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<div id="content">
<input aria-label="aria label" type="text" size=20>
<a href="#" aria-label="aria link">test</a>
</div>
<p id="description"></p>
<div id="console"></div>

<script>

description("This tests that the aria-label attribute works. The input and the A tag should return the appropriate description.");
description("This tests that the aria-label attribute works on both an input and an anchor.");

if (window.accessibilityController) {

var body = document.getElementById("body");
body.focus();
var obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
var succeeded;
if (accessibilityController.platformName == "atk")
succeeded = obj.title == "AXTitle: aria label";
else
succeeded = obj.description == "AXDescription: aria label";
shouldBe("succeeded", "true");

obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(1);
if (accessibilityController.platformName == "atk")
succeeded = obj.title == "AXTitle: aria link";
else
succeeded = obj.description == "AXDescription: aria link";
shouldBe("succeeded", "true");
}

var axInput = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
shouldBeEqualToString("platformValueForW3CName(axInput)", "aria label");

var axLink = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(1);
shouldBeEqualToString("platformValueForW3CName(axLink)", "aria link");

document.getElementById("content").style.visibility = "hidden";
}
</script>

<script src="../resources/js-test-post.js"></script>
@@ -1,10 +1,9 @@
Go
This tests that if try to use a non-rendered node as your labelledby element, it won't crash and it will work.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS button.description is 'AXDescription: TITLE'
PASS platformValueForW3CName(button) is "TITLE"
PASS successfullyParsed is true

TEST COMPLETE
@@ -3,11 +3,12 @@
<title id="title">TITLE</title>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body>

<div id="content">
<button id="button" aria-labelledby="title">Go</button>

</div>

<p id="description"></p>
<div id="console"></div>
@@ -17,10 +18,9 @@

if (window.accessibilityController) {
var button = accessibilityController.accessibleElementById("button");
if (accessibilityController.platformName == "atk")
shouldBe("button.title", "'AXTitle: TITLE'");
else
shouldBe("button.description", "'AXDescription: TITLE'");
shouldBeEqualToString("platformValueForW3CName(button)", "TITLE");

document.getElementById("content").style.visibility = "hidden";
}
</script>

@@ -1,3 +1,10 @@
This computer will self-destruct in minutes.
This verifies the accessible name of an input with multiple aria-labelledby elements.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS platformValueForW3CName(axInput) is "This computer will self-destruct in 10 minutes."
PASS successfullyParsed is true

TEST COMPLETE

The accessibility description is "AXDescription: This computer will self-destruct in 10 minutes."
@@ -1,24 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body>
<div id="content">
<span id="message">This computer will self-destruct in</span>
<input id="time" type="text" value="10" aria-labelledby="message time unit"/>
<span id="unit"> minutes.</span>
<div id="result"></div>
<script>
if (window.accessibilityController) {
var labeledItem = document.getElementById("time");
labeledItem.focus();
var result = document.getElementById("result");
if (accessibilityController.platformName == "atk")
result.innerText = "\nThe accessibility title is \"" + accessibilityController.focusedElement.title + "\"";
else
result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
}
</script>
</div>
<div id="console"></div>
<script>
description("This verifies the accessible name of an input with multiple aria-labelledby elements.");
if (window.accessibilityController) {
var labeledItem = document.getElementById("time").focus();
var axInput = accessibilityController.focusedElement;
shouldBeEqualToString("platformValueForW3CName(axInput)", "This computer will self-destruct in 10 minutes.");

document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
@@ -3,7 +3,7 @@ This tests that aria-labelledby overrides aria-labeledby correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS linkDescription is 'AXDescription: Y Z'
PASS platformValueForW3CName(axLink) is "Y Z"
PASS successfullyParsed is true

TEST COMPLETE

0 comments on commit f18a4f0

Please sign in to comment.