blob: 88fb007e4dd81185ad238c4b0c40b91a099b375b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
<script>
var successfullyParsed = false;
</script>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<ul id="tree0" role="tree" aria-labelledby="treelabel" aria-activedescendant="tree0_item0_2_0_1" tabindex="0">
<li id="tree0_item0" role="treeitem" aria-level="1" aria-expanded="true">
<span>
<span class="expander"></span>
Animals
</span>
<ul role="group">
<li id="tree0_item0_0" role="treeitem" aria-level="2"><span>Birds</span></li>
</ul>
</li>
</ul>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that when aria-expanded is toggled, the appropriate notifications are sent out");
var axTree = 0;
var notifyCount = 0;
var notifyName = 0;
// The order of notifications should be Row Count, Row Collapsed, Row Count, Row Expanded
function notifyCallback(notification) {
notifyName = notification;
if (notifyCount == 0) {
shouldBe("notifyName", "'AXRowCountChanged'");
}
else if (notifyCount == 1) {
shouldBe("notifyName", "'AXRowCollapsed'");
}
else if (notifyCount == 2) {
shouldBe("notifyName", "'AXRowCountChanged'");
}
else if (notifyCount == 3) {
shouldBe("notifyName", "'AXRowExpanded'");
axTree.removeNotificationListener();
window.layoutTestController.notifyDone();
}
notifyCount++;
}
if (window.accessibilityController) {
window.layoutTestController.waitUntilDone();
var domTree = document.getElementById("tree0");
domTree.focus();
axTree = window.accessibilityController.focusedElement;
var addedNotification = axTree.addNotificationListener(notifyCallback);
shouldBe("addedNotification", "true");
// the first aria-expanded should generate row count, row collapsed.
document.getElementById("tree0_item0").setAttribute("aria-expanded", "false");
// the second aria-expanded should generate row count, row expanded.
document.getElementById("tree0_item0").setAttribute("aria-expanded", "true");
}
successfullyParsed = true;
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>