blob: f3c88c7febb58cfd4469c381b77813f147187272 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/accessibility-helper.js"></script>
<script src="../resources/js-test.js"></script>
</head>
<body>
<a href="#" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
<a href="#" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
<a href="#" aria-haspopup="true" tabindex="0" id="link3">
<p id="paragraph1">Paragraph 1.</p>
</a>
<a href="#" aria-haspopup="false" tabindex="0" id="link4">
<p id="paragraph2">Paragraph 2.</p>
</a>
<a href="#" tabindex="0" id="link5">
<p id="paragraph3">Paragraph 3.</p>
</a>
<script>
var testOutput = "This tests that an element will report that it has a popup correctly.\n\n";
if (window.accessibilityController) {
window.jsTestIsAsync = true;
var linkOne = accessibilityController.accessibleElementById("link1");
testOutput += expect("linkOne.hasPopup", "true");
testOutput += expect("accessibilityController.accessibleElementById('link2').hasPopup", "false");
testOutput += expect("accessibilityController.accessibleElementById('paragraph1').hasPopup", "true");
testOutput += expect("accessibilityController.accessibleElementById('paragraph2').hasPopup", "false");
testOutput += expect("accessibilityController.accessibleElementById('paragraph3').hasPopup", "false");
testOutput += "\nSetting aria-haspopup to false for #link1.\n";
document.getElementById("link1").ariaHasPopup = "false";
setTimeout(async function() {
await waitFor(() => !linkOne.hasPopup );
testOutput += expect("linkOne.hasPopup", "false");
debug(testOutput);
finishJSTest();
}, 0);
}
</script>
</body>
</html>