gecko/accessible/tests/mochitest/test_aria_activedescendant.html

73 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=429547
-->
<head>
<title>aria-activedescendant property chrome tests</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript">
const ELEMENT_NODE = nsIDOMNode.ELEMENT_NODE;
var gContainerFocused = false;
function doTest()
{
var focusHandler = {
handleEvent: function handleEvent(aEvent) {
var target = aEvent.target;
if (target.nodeType == ELEMENT_NODE &&
target.getAttribute("id") == "container")
gContainerFocused = true;
}
};
var container = document.getElementById("container");
container.addEventListener("focus", focusHandler, false);
var item2Acc = getAccessible("item2");
if (item2Acc) {
item2Acc.takeFocus();
ok(gContainerFocused,
"Container with active descendant didn't receive the focus.");
}
container.removeEventListener("focus", focusHandler, false);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547"
title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()">
Mozilla Bug 429547
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div aria-activedescendant="item1" id="container" tabindex="1">
<div id="item1">item1</div>
<div id="item2">item2</div>
<div id="item3">item3</div>
</div>
</body>
</html>