Commit 94e56daf authored by Akihiro Ota's avatar Akihiro Ota Committed by Commit Bot

Refactor Layout Test to use testharness.js

Clean up aria-setsize-posinset.html Layout Test to use testharness
and be more human-readable. Larger goal is to more thoroughly test
the aria-posinset and aria-setSize attributes, especially in
ambiguous cases.

Change-Id: I950d45ceda2bbeb3fb10423812a13380b0da3ef4
Reviewed-on: https://chromium-review.googlesource.com/c/1332412Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Commit-Queue: Akihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607851}
parent 6d3f5ce7
Radio 1
This tests that aria-posinset and aria-setsize are exposed to accessibility correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS list.childAtIndex(0).setSize is 10
PASS list.childAtIndex(1).setSize is 10
PASS list.childAtIndex(0).posInSet is 3
PASS list.childAtIndex(1).posInSet is 5
PASS listbox.childAtIndex(0).setSize is 4
PASS listbox.childAtIndex(1).setSize is 4
PASS listbox.childAtIndex(2).setSize is 4
PASS listbox.childAtIndex(3).setSize is 4
PASS listbox.childAtIndex(0).posInSet is 1
PASS listbox.childAtIndex(1).posInSet is 2
PASS listbox.childAtIndex(2).posInSet is 3
PASS listbox.childAtIndex(3).posInSet is 4
PASS radio1.setSize is 1
PASS radio1.posInSet is 1
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
......@@ -10,6 +11,17 @@
<div role="listitem" aria-setSize="10" aria-posinset="5"></div>
</div>
<script>
test(function(t) {
var list = accessibilityController.accessibleElementById("list");
assert_equals(list.childAtIndex(0).posInSet,3);
assert_equals(list.childAtIndex(1).posInSet,5);
assert_equals(list.childAtIndex(0).setSize,10);
assert_equals(list.childAtIndex(1).setSize,10);
}, "Tests that aria-posinset and aria-setSize for a simple list are exposed to accessibility correctly");
</script>
<div id="listbox" role="listbox">
<div role="option"></div>
<div role="option"></div>
......@@ -17,43 +29,37 @@
<div role="option"></div>
</div>
<script>
test(function(t){
var listbox = accessibilityController.accessibleElementById("listbox");
assert_equals(listbox.childAtIndex(0).posInSet,1);
assert_equals(listbox.childAtIndex(1).posInSet,2);
assert_equals(listbox.childAtIndex(2).posInSet,3);
assert_equals(listbox.childAtIndex(3).posInSet,4);
assert_equals(listbox.childAtIndex(0).setSize,4);
assert_equals(listbox.childAtIndex(1).setSize,4);
assert_equals(listbox.childAtIndex(2).setSize,4);
assert_equals(listbox.childAtIndex(3).setSize,4);
}, "Tests that aria-posinset and aria-setSize for a listbox are exposed to accessibility correctly");
</script>
<div id="radiogroup" role="radiogroup">
<hr>
<div id="radio1" role="radio">Radio 1</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that aria-posinset and aria-setsize are exposed to accessibility correctly.");
if (window.accessibilityController) {
var list = accessibilityController.accessibleElementById("list");
shouldBe("list.childAtIndex(0).setSize", "10");
shouldBe("list.childAtIndex(1).setSize", "10");
shouldBe("list.childAtIndex(0).posInSet", "3");
shouldBe("list.childAtIndex(1).posInSet", "5");
var listbox = accessibilityController.accessibleElementById("listbox");
shouldBe("listbox.childAtIndex(0).setSize", "4");
shouldBe("listbox.childAtIndex(1).setSize", "4");
shouldBe("listbox.childAtIndex(2).setSize", "4");
shouldBe("listbox.childAtIndex(3).setSize", "4");
shouldBe("listbox.childAtIndex(0).posInSet", "1");
shouldBe("listbox.childAtIndex(1).posInSet", "2");
shouldBe("listbox.childAtIndex(2).posInSet", "3");
shouldBe("listbox.childAtIndex(3).posInSet", "4");
test(function(t){
var radio1 = accessibilityController.accessibleElementById("radio1");
shouldBe("radio1.setSize", "1");
shouldBe("radio1.posInSet", "1");
}
assert_equals(radio1.posInSet,1);
assert_equals(radio1.setSize,1);
},"Tests that aria-posinset and aria-setSize for a radio are exposed to accessibility correctly");
</script>
<p id="description"></p>
<div id="console"></div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment