blob: e0767d7485627a8b2e5aced986a77031ef7cd6a7 [file] [log] [blame]
<html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
<div role="group" id="parent">
<div role="button" id="button1">Button 1</div>
<div role="button" id="button2">Button 2</div>
<div role="button" id="button3">Button 3</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
function axElementById(id) {
return accessibilityController.accessibleElementById(id);
}
if (window.accessibilityController) {
description("This test makes sure that when aria-hidden changes, the AX hierarchy is updated.");
// Get the parent element.
var parent = axElementById("parent");
// Get all three children.
var button1 = axElementById("button1");
var button2 = axElementById("button2");
var button3 = axElementById("button3");
// Verify that the 3 children are present.
shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
shouldBeTrue("parent.childAtIndex(1).isEqual(button2)");
shouldBeTrue("parent.childAtIndex(2).isEqual(button3)");
// Make the 2nd button hidden. Only 1 and 3 should be present.
document.getElementById("button2").setAttribute("aria-hidden", "true");
shouldBeTrue("parent.childAtIndex(0).isEqual(button1)");
shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
// Make the 1st button hidden. Only 3 should be present.
document.getElementById("button1").setAttribute("aria-hidden", "true");
shouldBeTrue("parent.childAtIndex(0).isEqual(button3)");
// Make the 2nd button not hidden. 2 and 3 should be present.
document.getElementById("button2").setAttribute("aria-hidden", "false");
shouldBeTrue("parent.childAtIndex(0).isEqual(button2)");
shouldBeTrue("parent.childAtIndex(1).isEqual(button3)");
}
</script>
</body>
</html>