73 lines
2.4 KiB
HTML
73 lines
2.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test.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 = "";
|
|
// The order of notifications should be RowCount, RowCollapsed, RowCount, RowExpanded.
|
|
function notifyCallback(element, notification) {
|
|
if (notification == "AXLoadComplete"
|
|
|| notification == "AXLayoutComplete"
|
|
|| notification == "AXFocusChanged")
|
|
return;
|
|
|
|
notifyName = notification;
|
|
if (notifyCount == 0)
|
|
shouldBeEqualToString("notifyName", "AXRowCountChanged");
|
|
else if (notifyCount == 1)
|
|
shouldBeEqualToString("notifyName", "AXRowCollapsed");
|
|
else if (notifyCount == 2)
|
|
shouldBeEqualToString("notifyName", "AXRowCountChanged");
|
|
else if (notifyCount == 3) {
|
|
shouldBeEqualToString("notifyName", "AXRowExpanded");
|
|
accessibilityController.removeNotificationListener();
|
|
finishJSTest();
|
|
}
|
|
|
|
notifyCount++;
|
|
}
|
|
|
|
if (window.accessibilityController) {
|
|
window.jsTestIsAsync = true;
|
|
|
|
var domTree = document.getElementById("tree0");
|
|
domTree.focus();
|
|
|
|
var addedNotification = accessibilityController.addNotificationListener(notifyCallback);
|
|
shouldBe("addedNotification", "true");
|
|
|
|
accessibilityController.accessibleElementById("tree0");
|
|
accessibilityController.accessibleElementById("tree0_item0");
|
|
|
|
// The following should generate notifications RowCount, RowCollapsed.
|
|
document.getElementById("tree0_item0").setAttribute("aria-expanded", "false");
|
|
|
|
// The following should generate notifications RowCount, RowExpanded.
|
|
document.getElementById("tree0_item0").setAttribute("aria-expanded", "true");
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|