blob: f2a2fdfd41fa5e29435eb47e41f10a227bbdab47 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../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>
<div id="notifications"></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(element, notification) {
notifyName = notification;
document.getElementById("notifications").innerHTML += "Notification: " + notifyName + "<br>";
if (notifyCount == 4) {
accessibilityController.removeNotificationListener();
window.testRunner.notifyDone();
}
notifyCount++;
}
if (window.accessibilityController) {
window.testRunner.waitUntilDone();
var domTree = document.getElementById("tree0");
domTree.focus();
axTree = window.accessibilityController.focusedElement;
var addedNotification = accessibilityController.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");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>