mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
102 lines
3.2 KiB
HTML
102 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=429285
|
|
-->
|
|
<head>
|
|
<title>Propagate aria-disabled state to descendants 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">
|
|
// Mapping needed state flags for easier handling.
|
|
const state_disabled =
|
|
Components.interfaces.nsIAccessibleStates.STATE_UNAVAILABLE;
|
|
const state_focusable =
|
|
Components.interfaces.nsIAccessibleStates.STATE_FOCUSABLE;
|
|
|
|
const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
|
|
const nsIAccessible = Components.interfaces.nsIAccessible;
|
|
|
|
var gAccRetrieval = null;
|
|
|
|
function testChildren(aID, aAcc)
|
|
{
|
|
// Check state of aAcc first.
|
|
var state = {}, extraState = {};
|
|
aAcc.getState(state, extraState);
|
|
if (state.value & state_focusable) {
|
|
is(state.value & state_disabled, state_disabled,
|
|
"Wrong disabled state bit for " + aID + "!");
|
|
}
|
|
|
|
// Iterate over its children to see if they are disabled, too.
|
|
var children = null;
|
|
try {
|
|
children = aAcc.children;
|
|
} catch(e) {}
|
|
ok(children, "Could not get children for " + aID +"!");
|
|
|
|
if (children) {
|
|
for (var i=0; i<children.length; i++) {
|
|
var childAcc = children.queryElementAt(i, nsIAccessible);
|
|
// Test and recurse over its children as well.
|
|
testChildren(childAcc.name, childAcc);
|
|
}
|
|
}
|
|
}
|
|
|
|
function doTest()
|
|
{
|
|
gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
|
getService(nsIAccessibleRetrieval);
|
|
|
|
var groupItem = document.getElementById("group");
|
|
var groupAcc = null;
|
|
try {
|
|
groupAcc = gAccRetrieval.getAccessibleFor(groupItem);
|
|
} catch (e) {}
|
|
ok (groupAcc,
|
|
"No accessible for group element!");
|
|
|
|
if (groupAcc) {
|
|
var state = {}, extraState = {};
|
|
groupAcc.getState(state, extraState);
|
|
is(state.value & state_disabled, state_disabled,
|
|
"Wrong disabled state bit for Group element!");
|
|
testChildren("group", groupAcc);
|
|
}
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addLoadEvent(doTest);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=429285"
|
|
title="Propagate aria-disabled to descendants">
|
|
Mozilla Bug 429285
|
|
</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
|
|
<div id="group" role="group" aria-disabled="true">
|
|
<button>hi</button>
|
|
<div tabindex="0" role="listbox" aria-activedescendant="item1">
|
|
<div role="option" id="item1">Item 1</div>
|
|
<div role="option" id="item2">Item 2</div>
|
|
<div role="option" id="item3">Item 3</div>
|
|
<div role="option" id="item4">Item 4</div>
|
|
</div>
|
|
<div role="slider" tabindex="0">A slider</div>
|
|
</div>
|
|
</body>
|
|
</html>
|