2009-01-27 09:27:51 -08:00
|
|
|
<?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="nsIAccessible::getAccessibleRelated() tests">
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../common.js" />
|
2009-01-27 09:27:51 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../relations.js" />
|
2009-03-07 03:23:25 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../role.js" />
|
2009-01-27 09:27:51 -08:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
<![CDATA[
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
// xul:label@control
|
|
|
|
testRelation("label1", RELATION_LABEL_FOR, "checkbox1");
|
|
|
|
testRelation("checkbox1", RELATION_LABELLED_BY, "label1");
|
|
|
|
|
2010-11-19 18:37:18 -08:00
|
|
|
// xul:label@control, multiple
|
|
|
|
testRelation("label1_1", RELATION_LABEL_FOR, "checkbox1_1");
|
|
|
|
testRelation("label1_2", RELATION_LABEL_FOR, "checkbox1_1");
|
|
|
|
testRelation("checkbox1_1", RELATION_LABELLED_BY,
|
|
|
|
[ "label1_1", "label1_2" ]);
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// aria-labelledby
|
|
|
|
testRelation("label2", RELATION_LABEL_FOR, "checkbox2");
|
|
|
|
testRelation("checkbox2", RELATION_LABELLED_BY, "label2");
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
// aria-labelledby, multiple relations
|
|
|
|
testRelation("label3", RELATION_LABEL_FOR, "checkbox3");
|
|
|
|
testRelation("label4", RELATION_LABEL_FOR, "checkbox3");
|
|
|
|
testRelation("checkbox3", RELATION_LABELLED_BY, ["label3", "label4"]);
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// aria-describedby
|
2009-02-10 02:03:30 -08:00
|
|
|
testRelation("descr1", RELATION_DESCRIPTION_FOR, "checkbox4");
|
|
|
|
testRelation("checkbox4", RELATION_DESCRIBED_BY, "descr1");
|
|
|
|
|
|
|
|
// aria-describedby, multiple relations
|
|
|
|
testRelation("descr2", RELATION_DESCRIPTION_FOR, "checkbox5");
|
|
|
|
testRelation("descr3", RELATION_DESCRIPTION_FOR, "checkbox5");
|
|
|
|
testRelation("checkbox5", RELATION_DESCRIBED_BY, ["descr2", "descr3"]);
|
2009-01-27 09:27:51 -08:00
|
|
|
|
|
|
|
// xul:description@control
|
2009-02-10 02:03:30 -08:00
|
|
|
testRelation("descr4", RELATION_DESCRIPTION_FOR, "checkbox6");
|
|
|
|
testRelation("checkbox6", RELATION_DESCRIBED_BY, "descr4");
|
2009-01-27 09:27:51 -08:00
|
|
|
|
2010-11-19 18:37:18 -08:00
|
|
|
// xul:description@control, multiple
|
|
|
|
testRelation("descr5", RELATION_DESCRIPTION_FOR, "checkbox7");
|
|
|
|
testRelation("descr6", RELATION_DESCRIPTION_FOR, "checkbox7");
|
|
|
|
testRelation("checkbox7", RELATION_DESCRIBED_BY,
|
|
|
|
[ "descr5", "descr6" ]);
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
// aria_owns, multiple relations
|
2009-01-27 09:27:51 -08:00
|
|
|
testRelation("treeitem1", RELATION_NODE_CHILD_OF, "tree");
|
2009-02-10 02:03:30 -08:00
|
|
|
testRelation("treeitem2", RELATION_NODE_CHILD_OF, "tree");
|
2009-01-27 09:27:51 -08:00
|
|
|
|
|
|
|
// 'node child of' relation for outlineitem role
|
|
|
|
testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree");
|
2009-02-10 02:03:30 -08:00
|
|
|
testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
|
|
|
|
testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
|
2009-01-27 09:27:51 -08:00
|
|
|
|
2011-07-22 06:40:37 -07:00
|
|
|
// no relation node_child_of for accessible contained in an unexpected
|
|
|
|
// parent
|
|
|
|
testRelation("treeitem6", RELATION_NODE_CHILD_OF, null);
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// 'node child of' relation for the document having window, returns
|
|
|
|
// direct accessible parent (fixed in bug 419770).
|
|
|
|
var iframeElmObj = {};
|
|
|
|
var iframeAcc = getAccessible("iframe", null, iframeElmObj);
|
|
|
|
var iframeDoc = iframeElmObj.value.contentDocument;
|
|
|
|
var iframeDocAcc = getAccessible(iframeDoc);
|
|
|
|
testRelation(iframeDocAcc, RELATION_NODE_CHILD_OF, iframeAcc);
|
|
|
|
|
|
|
|
// aria-controls
|
2010-11-17 18:55:44 -08:00
|
|
|
getAccessible("tab");
|
|
|
|
todo(false,
|
|
|
|
"Getting an accessible tab, otherwise relations for tabpanel aren't cached. Bug 606924 will fix that.");
|
2009-01-27 09:27:51 -08:00
|
|
|
testRelation("tabpanel", RELATION_CONTROLLED_BY, "tab");
|
|
|
|
testRelation("tab", RELATION_CONTROLLER_FOR, "tabpanel");
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
// aria-controls, multiple relations
|
|
|
|
testRelation("lr1", RELATION_CONTROLLED_BY, "button");
|
|
|
|
testRelation("lr2", RELATION_CONTROLLED_BY, "button");
|
|
|
|
testRelation("button", RELATION_CONTROLLER_FOR, ["lr1", "lr2"]);
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// aria-flowto
|
|
|
|
testRelation("flowto", RELATION_FLOWS_TO, "flowfrom");
|
|
|
|
testRelation("flowfrom", RELATION_FLOWS_FROM, "flowto");
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
// aria-flowto, multiple relations
|
|
|
|
testRelation("flowto1", RELATION_FLOWS_TO, ["flowfrom1", "flowfrom2"]);
|
|
|
|
testRelation("flowfrom1", RELATION_FLOWS_FROM, "flowto1");
|
|
|
|
testRelation("flowfrom2", RELATION_FLOWS_FROM, "flowto1");
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// 'default button' relation
|
|
|
|
testRelation("textbox", RELATION_DEFAULT_BUTTON, "submit");
|
|
|
|
|
|
|
|
// 'labelled by'/'label for' relation for xul:goupbox and xul:label of
|
|
|
|
// xul:caption
|
|
|
|
var groupboxAcc = getAccessible("groupbox");
|
|
|
|
var labelAcc = groupboxAcc.firstChild;
|
|
|
|
testRelation(labelAcc, RELATION_LABEL_FOR, groupboxAcc);
|
|
|
|
testRelation(groupboxAcc, RELATION_LABELLED_BY, labelAcc);
|
|
|
|
|
2009-02-27 03:01:33 -08:00
|
|
|
// 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
|
|
|
|
// (fixed in bug 366527)
|
|
|
|
testRelation("tabpanel1", RELATION_LABELLED_BY, "tab1");
|
|
|
|
testRelation("tab1", RELATION_LABEL_FOR, "tabpanel1");
|
|
|
|
testRelation("tabpanel2", RELATION_LABELLED_BY, "tab2");
|
|
|
|
testRelation("tab2", RELATION_LABEL_FOR, "tabpanel2");
|
|
|
|
testRelation("tabpanel3", RELATION_LABELLED_BY, "tab3");
|
|
|
|
testRelation("tab3", RELATION_LABEL_FOR, "tabpanel3");
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
// finish test
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-09-23 07:21:47 -07:00
|
|
|
addA11yLoadEvent(doTest);
|
2009-01-27 09:27:51 -08:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<vbox style="overflow: auto;" flex="1">
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=475298"
|
|
|
|
title="mochitests for accessible relations">
|
|
|
|
Mozilla Bug 475298
|
|
|
|
</a><br/>
|
2011-07-22 06:40:37 -07:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=673389"
|
|
|
|
title="node_child_of on an item not in a proper container">
|
|
|
|
Mozilla Bug 67389
|
|
|
|
</a><br/>
|
2009-01-27 09:27:51 -08:00
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
<label id="label1" control="checkbox1">label</label>
|
|
|
|
<checkbox id="checkbox1"/>
|
|
|
|
|
2010-11-19 18:37:18 -08:00
|
|
|
<label id="label1_1" control="checkbox1_1">label</label>
|
|
|
|
<label id="label1_2" control="checkbox1_1">label</label>
|
|
|
|
<checkbox id="checkbox1_1"/>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
<description id="label2">label</description>
|
|
|
|
<description role="checkbox" id="checkbox2" aria-labelledby="label2"/>
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
<description id="label3">label</description>
|
|
|
|
<description id="label4">label</description>
|
|
|
|
<description role="checkbox" id="checkbox3"
|
|
|
|
aria-labelledby="label3 label4"/>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
<description id="descr1">description</description>
|
2009-02-10 02:03:30 -08:00
|
|
|
<description role="checkbox" id="checkbox4" aria-describedby="descr1"/>
|
|
|
|
|
|
|
|
<description id="descr2">label</description>
|
|
|
|
<description id="descr3">label</description>
|
|
|
|
<description role="checkbox" id="checkbox5"
|
|
|
|
aria-describedby="descr2 descr3"/>
|
2009-01-27 09:27:51 -08:00
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
<description id="descr4" control="checkbox6">description</description>
|
|
|
|
<checkbox id="checkbox6"/>
|
2009-01-27 09:27:51 -08:00
|
|
|
|
2010-11-19 18:37:18 -08:00
|
|
|
<description id="descr5" control="checkbox7">description</description>
|
|
|
|
<description id="descr6" control="checkbox7">description</description>
|
|
|
|
<checkbox id="checkbox7"/>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
<description role="treeitem" id="treeitem1">Yellow</description>
|
2009-02-10 02:03:30 -08:00
|
|
|
<description role="treeitem" id="treeitem2">Orange</description>
|
|
|
|
<vbox id="tree" role="tree" aria-owns="treeitem1 treeitem2">
|
|
|
|
<description role="treeitem" id="treeitem3">Blue</description>
|
|
|
|
<description role="treeitem" id="treeitem4" aria-level="1">Green</description>
|
|
|
|
<description role="treeitem" id="treeitem5" aria-level="2">Light green</description>
|
2009-01-27 09:27:51 -08:00
|
|
|
</vbox>
|
|
|
|
|
2011-07-22 06:40:37 -07:00
|
|
|
<description role="treeitem" id="treeitem6">Dark green</description>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
<iframe id="iframe"/>
|
|
|
|
|
|
|
|
<hbox id="tablist" role="tablist">
|
|
|
|
<description id="tab" role="tab" aria-controls="tabpanel">tab</description>
|
|
|
|
</hbox>
|
|
|
|
<description id="tabpanel" role="tabpanel">tabpanel</description>
|
|
|
|
|
2009-02-10 02:03:30 -08:00
|
|
|
<description id="lr1" aria-live="assertive">1</description>
|
|
|
|
<description id="lr2" aria-live="assertive">a</description>
|
|
|
|
<button id="button" aria-controls="lr1 lr2" label="button"
|
|
|
|
oncommand="getNode('lr1').textContent += '1'; getNode('lr2').textContent += 'a';"/>
|
|
|
|
|
|
|
|
<description id="flowto1" aria-flowto="flowfrom1 flowfrom2">flow to</description>
|
|
|
|
<description id="flowfrom1">flow from</description>
|
|
|
|
<description id="flowfrom2">flow from</description>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
<description id="flowto" aria-flowto="flowfrom">flow to</description>
|
|
|
|
<description id="flowfrom">flow from</description>
|
|
|
|
|
|
|
|
<textbox id="textbox"/>
|
|
|
|
<button id="submit" default="true" label="Default"/>
|
|
|
|
|
|
|
|
<groupbox id="groupbox">
|
|
|
|
<caption label="caption"/>
|
|
|
|
</groupbox>
|
2009-02-27 03:01:33 -08:00
|
|
|
|
|
|
|
<tabbox>
|
|
|
|
<tabs>
|
|
|
|
<tab label="tab1" id="tab1"/>
|
|
|
|
<tab label="tab2" id="tab2" linkedpanel="tabpanel2"/>
|
|
|
|
<tab label="tab3" id="tab3" linkedpanel="tabpanel3"/>
|
|
|
|
</tabs>
|
|
|
|
<tabpanels>
|
|
|
|
<tabpanel id="tabpanel1">
|
|
|
|
<description>tabpanel1</description>
|
|
|
|
</tabpanel>
|
|
|
|
<tabpanel id="tabpanel3">
|
|
|
|
<description>tabpanel3</description>
|
|
|
|
</tabpanel>
|
|
|
|
<tabpanel id="tabpanel2">
|
|
|
|
<description>tabpanel2</description>
|
|
|
|
</tabpanel>
|
|
|
|
</tabpanels>
|
|
|
|
</tabbox>
|
|
|
|
|
2009-01-27 09:27:51 -08:00
|
|
|
</vbox>
|
|
|
|
</window>
|
|
|
|
|