blob: 82f1bd4d8f41c5c4ee82facabf7bfe0463262213 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content">
<div id="test0" role="button" aria-haspopup="true">X</div>
<div id="test1" role="button" aria-haspopup="dialog">X</div>
<div id="test2" role="button" aria-haspopup="grid">X</div>
<div id="test3" role="button" aria-haspopup="listbox">X</div>
<div id="test4" role="button" aria-haspopup="menu">X</div>
<div id="test5" role="button" aria-haspopup="tree">X</div>
<div id="test6" role="button">X</div>
<div id="test7" role="button" aria-haspopup="false">X</div>
<div id="test8" role="button" aria-haspopup="foo">X</div>
<div id="test9" role="button" aria-haspopup="">X</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests the platform attributes exposed for buttons with aria-haspopup");
if (window.accessibilityController) {
// Get the document and accessibility elements for test0 to be used as reference to check traits against.
var element = document.getElementById("test0");
shouldBe("element.hasAttribute('aria-haspopup')", "true");
var axElement = accessibilityController.accessibleElementById("test0");
var haspopupTraits = axElement.traits;
// Check that accessibilityHasPopupValue returns the right value in each case.
debug("AX popupValue = " + "'" + axElement.popupValue + "'");
for (var i = 1; i <= 9; i++) {
var element = document.getElementById("test" + i);
var popup = element.getAttribute("aria-haspopup");
var axElement = accessibilityController.accessibleElementById("test" + i);
var sameTraits = axElement.traits == haspopupTraits;
debug("test" + i + " has trait haspopup = " + sameTraits + " with aria-haspopup attribute = " + popup);
// Check that accessibilityHasPopupValue returns the right value in each case.
debug("AX popupValue = " + "'" + axElement.popupValue + "'");
}
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>