gecko/accessible/tests/mochitest/test_groupattrs.xul

74 lines
2.3 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility Group Attributes ('level', 'setsize', 'posinset') Test.">
<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 type="application/javascript">
<![CDATA[
var gAccService = null;
function accAttributes(aId)
{
this.getAttribute = function getAttribute(aName)
{
try {
return this.mAttrs.getStringProperty(aName);
} catch (e) {
alert(e);
return "";
}
}
this.mAcc = gAccService.getAccessibleFor(document.getElementById(aId));
this.mAttrs = this.mAcc.attributes;
}
function doTest()
{
// Activate accessibility, otherwise events aren't fired.
gAccService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(Components.interfaces.nsIAccessibleRetrieval);
var attrs = new accAttributes("item1");
is(attrs.getAttribute("posinset"), "1", "Wrong posinset on item1.");
is(attrs.getAttribute("setsize"), "2", "Wrong setsize on item1.");
attrs = new accAttributes("item2");
is(attrs.getAttribute("posinset"), "2", "Wrong posinset on item2.");
is(attrs.getAttribute("setsize"), "2", "Wrong setsize on item2.");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=417317"
title="Certain types of LISTITEM accessibles no longer get attributes set like 'x of y', regression from fix for bug 389926">
Mozilla Bug 417317
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<listbox>
<listitem label="item1" id="item1"/>
<listitem label="item2" id="item2"/>
</listbox>
</window>