1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/relations/test_general.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,238 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="nsIAccessible::getAccessibleRelated() tests"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js" /> 1.17 + <script type="application/javascript" 1.18 + src="../relations.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../role.js" /> 1.21 + 1.22 + <script type="application/javascript"> 1.23 + <![CDATA[ 1.24 + function doTest() 1.25 + { 1.26 + // xul:label@control 1.27 + testRelation("label1", RELATION_LABEL_FOR, "checkbox1"); 1.28 + testRelation("checkbox1", RELATION_LABELLED_BY, "label1"); 1.29 + 1.30 + // xul:label@control, multiple 1.31 + testRelation("label1_1", RELATION_LABEL_FOR, "checkbox1_1"); 1.32 + testRelation("label1_2", RELATION_LABEL_FOR, "checkbox1_1"); 1.33 + testRelation("checkbox1_1", RELATION_LABELLED_BY, 1.34 + [ "label1_1", "label1_2" ]); 1.35 + 1.36 + // aria-labelledby 1.37 + testRelation("label2", RELATION_LABEL_FOR, "checkbox2"); 1.38 + testRelation("checkbox2", RELATION_LABELLED_BY, "label2"); 1.39 + 1.40 + // aria-labelledby, multiple relations 1.41 + testRelation("label3", RELATION_LABEL_FOR, "checkbox3"); 1.42 + testRelation("label4", RELATION_LABEL_FOR, "checkbox3"); 1.43 + testRelation("checkbox3", RELATION_LABELLED_BY, ["label3", "label4"]); 1.44 + 1.45 + // aria-describedby 1.46 + testRelation("descr1", RELATION_DESCRIPTION_FOR, "checkbox4"); 1.47 + testRelation("checkbox4", RELATION_DESCRIBED_BY, "descr1"); 1.48 + 1.49 + // aria-describedby, multiple relations 1.50 + testRelation("descr2", RELATION_DESCRIPTION_FOR, "checkbox5"); 1.51 + testRelation("descr3", RELATION_DESCRIPTION_FOR, "checkbox5"); 1.52 + testRelation("checkbox5", RELATION_DESCRIBED_BY, ["descr2", "descr3"]); 1.53 + 1.54 + // xul:description@control 1.55 + testRelation("descr4", RELATION_DESCRIPTION_FOR, "checkbox6"); 1.56 + testRelation("checkbox6", RELATION_DESCRIBED_BY, "descr4"); 1.57 + 1.58 + // xul:description@control, multiple 1.59 + testRelation("descr5", RELATION_DESCRIPTION_FOR, "checkbox7"); 1.60 + testRelation("descr6", RELATION_DESCRIPTION_FOR, "checkbox7"); 1.61 + testRelation("checkbox7", RELATION_DESCRIBED_BY, 1.62 + [ "descr5", "descr6" ]); 1.63 + 1.64 + // aria_owns, multiple relations 1.65 + testRelation("treeitem1", RELATION_NODE_CHILD_OF, "tree"); 1.66 + testRelation("treeitem2", RELATION_NODE_CHILD_OF, "tree"); 1.67 + 1.68 + // 'node child of' relation for outlineitem role 1.69 + testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree"); 1.70 + testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree"); 1.71 + testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4"); 1.72 + 1.73 + // no relation node_child_of for accessible contained in an unexpected 1.74 + // parent 1.75 + testRelation("treeitem6", RELATION_NODE_CHILD_OF, null); 1.76 + 1.77 + // 'node child of' relation for the document having window, returns 1.78 + // direct accessible parent (fixed in bug 419770). 1.79 + var iframeElmObj = {}; 1.80 + var iframeAcc = getAccessible("iframe", null, iframeElmObj); 1.81 + var iframeDoc = iframeElmObj.value.contentDocument; 1.82 + var iframeDocAcc = getAccessible(iframeDoc); 1.83 + testRelation(iframeDocAcc, RELATION_NODE_CHILD_OF, iframeAcc); 1.84 + 1.85 + // aria-controls 1.86 + getAccessible("tab"); 1.87 + todo(false, 1.88 + "Getting an accessible tab, otherwise relations for tabpanel aren't cached. Bug 606924 will fix that."); 1.89 + testRelation("tabpanel", RELATION_CONTROLLED_BY, "tab"); 1.90 + testRelation("tab", RELATION_CONTROLLER_FOR, "tabpanel"); 1.91 + 1.92 + // aria-controls, multiple relations 1.93 + testRelation("lr1", RELATION_CONTROLLED_BY, "button"); 1.94 + testRelation("lr2", RELATION_CONTROLLED_BY, "button"); 1.95 + testRelation("button", RELATION_CONTROLLER_FOR, ["lr1", "lr2"]); 1.96 + 1.97 + // aria-flowto 1.98 + testRelation("flowto", RELATION_FLOWS_TO, "flowfrom"); 1.99 + testRelation("flowfrom", RELATION_FLOWS_FROM, "flowto"); 1.100 + 1.101 + // aria-flowto, multiple relations 1.102 + testRelation("flowto1", RELATION_FLOWS_TO, ["flowfrom1", "flowfrom2"]); 1.103 + testRelation("flowfrom1", RELATION_FLOWS_FROM, "flowto1"); 1.104 + testRelation("flowfrom2", RELATION_FLOWS_FROM, "flowto1"); 1.105 + 1.106 + // 'default button' relation 1.107 + testRelation("textbox", RELATION_DEFAULT_BUTTON, "submit"); 1.108 + 1.109 + // 'labelled by'/'label for' relation for xul:goupbox and xul:label of 1.110 + // xul:caption 1.111 + var groupboxAcc = getAccessible("groupbox"); 1.112 + var labelAcc = groupboxAcc.firstChild; 1.113 + testRelation(labelAcc, RELATION_LABEL_FOR, groupboxAcc); 1.114 + testRelation(groupboxAcc, RELATION_LABELLED_BY, labelAcc); 1.115 + 1.116 + // 'labelled by'/'label for' relations for xul:tab and xul:tabpanel 1.117 + // (fixed in bug 366527) 1.118 + testRelation("tabpanel1", RELATION_LABELLED_BY, "tab1"); 1.119 + testRelation("tab1", RELATION_LABEL_FOR, "tabpanel1"); 1.120 + testRelation("tabpanel2", RELATION_LABELLED_BY, "tab2"); 1.121 + testRelation("tab2", RELATION_LABEL_FOR, "tabpanel2"); 1.122 + testRelation("tabpanel3", RELATION_LABELLED_BY, "tab3"); 1.123 + testRelation("tab3", RELATION_LABEL_FOR, "tabpanel3"); 1.124 + 1.125 + // finish test 1.126 + SimpleTest.finish(); 1.127 + } 1.128 + 1.129 + SimpleTest.waitForExplicitFinish(); 1.130 + addA11yLoadEvent(doTest); 1.131 + ]]> 1.132 + </script> 1.133 + 1.134 + <vbox style="overflow: auto;" flex="1"> 1.135 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.136 + <a target="_blank" 1.137 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=475298" 1.138 + title="mochitests for accessible relations"> 1.139 + Mozilla Bug 475298 1.140 + </a><br/> 1.141 + <a target="_blank" 1.142 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=673389" 1.143 + title="node_child_of on an item not in a proper container"> 1.144 + Mozilla Bug 67389 1.145 + </a><br/> 1.146 + 1.147 + <p id="display"></p> 1.148 + <div id="content" style="display: none"> 1.149 + </div> 1.150 + <pre id="test"> 1.151 + </pre> 1.152 + </body> 1.153 + 1.154 + <label id="label1" control="checkbox1">label</label> 1.155 + <checkbox id="checkbox1"/> 1.156 + 1.157 + <label id="label1_1" control="checkbox1_1">label</label> 1.158 + <label id="label1_2" control="checkbox1_1">label</label> 1.159 + <checkbox id="checkbox1_1"/> 1.160 + 1.161 + <description id="label2">label</description> 1.162 + <description role="checkbox" id="checkbox2" aria-labelledby="label2"/> 1.163 + 1.164 + <description id="label3">label</description> 1.165 + <description id="label4">label</description> 1.166 + <description role="checkbox" id="checkbox3" 1.167 + aria-labelledby="label3 label4"/> 1.168 + 1.169 + <description id="descr1">description</description> 1.170 + <description role="checkbox" id="checkbox4" aria-describedby="descr1"/> 1.171 + 1.172 + <description id="descr2">label</description> 1.173 + <description id="descr3">label</description> 1.174 + <description role="checkbox" id="checkbox5" 1.175 + aria-describedby="descr2 descr3"/> 1.176 + 1.177 + <description id="descr4" control="checkbox6">description</description> 1.178 + <checkbox id="checkbox6"/> 1.179 + 1.180 + <description id="descr5" control="checkbox7">description</description> 1.181 + <description id="descr6" control="checkbox7">description</description> 1.182 + <checkbox id="checkbox7"/> 1.183 + 1.184 + <description role="treeitem" id="treeitem1">Yellow</description> 1.185 + <description role="treeitem" id="treeitem2">Orange</description> 1.186 + <vbox id="tree" role="tree" aria-owns="treeitem1 treeitem2"> 1.187 + <description role="treeitem" id="treeitem3">Blue</description> 1.188 + <description role="treeitem" id="treeitem4" aria-level="1">Green</description> 1.189 + <description role="treeitem" id="treeitem5" aria-level="2">Light green</description> 1.190 + </vbox> 1.191 + 1.192 + <description role="treeitem" id="treeitem6">Dark green</description> 1.193 + 1.194 + <iframe id="iframe"/> 1.195 + 1.196 + <hbox id="tablist" role="tablist"> 1.197 + <description id="tab" role="tab" aria-controls="tabpanel">tab</description> 1.198 + </hbox> 1.199 + <description id="tabpanel" role="tabpanel">tabpanel</description> 1.200 + 1.201 + <description id="lr1" aria-live="assertive">1</description> 1.202 + <description id="lr2" aria-live="assertive">a</description> 1.203 + <button id="button" aria-controls="lr1 lr2" label="button" 1.204 + oncommand="getNode('lr1').textContent += '1'; getNode('lr2').textContent += 'a';"/> 1.205 + 1.206 + <description id="flowto1" aria-flowto="flowfrom1 flowfrom2">flow to</description> 1.207 + <description id="flowfrom1">flow from</description> 1.208 + <description id="flowfrom2">flow from</description> 1.209 + 1.210 + <description id="flowto" aria-flowto="flowfrom">flow to</description> 1.211 + <description id="flowfrom">flow from</description> 1.212 + 1.213 + <textbox id="textbox"/> 1.214 + <button id="submit" default="true" label="Default"/> 1.215 + 1.216 + <groupbox id="groupbox"> 1.217 + <caption label="caption"/> 1.218 + </groupbox> 1.219 + 1.220 + <tabbox> 1.221 + <tabs> 1.222 + <tab label="tab1" id="tab1"/> 1.223 + <tab label="tab2" id="tab2" linkedpanel="tabpanel2"/> 1.224 + <tab label="tab3" id="tab3" linkedpanel="tabpanel3"/> 1.225 + </tabs> 1.226 + <tabpanels> 1.227 + <tabpanel id="tabpanel1"> 1.228 + <description>tabpanel1</description> 1.229 + </tabpanel> 1.230 + <tabpanel id="tabpanel3"> 1.231 + <description>tabpanel3</description> 1.232 + </tabpanel> 1.233 + <tabpanel id="tabpanel2"> 1.234 + <description>tabpanel2</description> 1.235 + </tabpanel> 1.236 + </tabpanels> 1.237 + </tabbox> 1.238 + 1.239 + </vbox> 1.240 +</window> 1.241 +