1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/tree/test_combobox.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,286 @@ 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="Accessible XUL menulist and textbox @autocomplete hierarchy 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="../role.js" /> 1.19 + 1.20 + <script type="application/javascript"> 1.21 + <![CDATA[ 1.22 + //////////////////////////////////////////////////////////////////////////// 1.23 + // Test 1.24 + 1.25 + function doTest() 1.26 + { 1.27 + ////////////////////////////////////////////////////////////////////////// 1.28 + // menulist 1.29 + 1.30 + var accTree = { 1.31 + role: ROLE_COMBOBOX, 1.32 + children: [ 1.33 + { 1.34 + role: ROLE_COMBOBOX_LIST, 1.35 + children: [ 1.36 + { 1.37 + role: ROLE_COMBOBOX_OPTION, 1.38 + children: [] 1.39 + }, 1.40 + { 1.41 + role: ROLE_COMBOBOX_OPTION, 1.42 + children: [] 1.43 + } 1.44 + ] 1.45 + } 1.46 + ] 1.47 + }; 1.48 + 1.49 + if (!MAC) { 1.50 + testAccessibleTree("menulist", accTree); 1.51 + } else { 1.52 + todo(false, "Make this test pass on OSX (bug 650366)"); 1.53 + } 1.54 + 1.55 + ////////////////////////////////////////////////////////////////////////// 1.56 + // editable menulist 1.57 + 1.58 + accTree = { 1.59 + role: ROLE_COMBOBOX, 1.60 + children: [ 1.61 + { 1.62 + role: ROLE_ENTRY, 1.63 + children: [ 1.64 + // no text leaf accessible for text node 1.65 + ] 1.66 + }, 1.67 + { 1.68 + role: ROLE_COMBOBOX_LIST, // context menu 1.69 + children: [] 1.70 + }, 1.71 + { 1.72 + role: ROLE_PUSHBUTTON, // dropmarker 1.73 + children: [] 1.74 + }, 1.75 + { 1.76 + role: ROLE_COMBOBOX_LIST, // option list 1.77 + children: [ 1.78 + { 1.79 + role: ROLE_COMBOBOX_OPTION, 1.80 + children: [] 1.81 + }, 1.82 + { 1.83 + role: ROLE_COMBOBOX_OPTION, 1.84 + children: [] 1.85 + } 1.86 + ] 1.87 + } 1.88 + ] 1.89 + }; 1.90 + 1.91 + if (!MAC) { 1.92 + testAccessibleTree("menulist2", accTree); 1.93 + } else { 1.94 + todo(false, "Make this test pass on OSX (bug 551957)"); 1.95 + } 1.96 + 1.97 + ////////////////////////////////////////////////////////////////////////// 1.98 + // textbox@type=autocomplete #1 (history) 1.99 + 1.100 + accTree = { 1.101 + // textbox 1.102 + role: ROLE_AUTOCOMPLETE, 1.103 + children: [ 1.104 + { 1.105 + // html:input 1.106 + role: ROLE_ENTRY, 1.107 + children: [ 1.108 + { 1.109 + // #text 1.110 + role: ROLE_TEXT_LEAF, 1.111 + name: "http://mochi.test:8888/redirect-a11y.html", 1.112 + children: [] 1.113 + } 1.114 + ] 1.115 + }, 1.116 + { 1.117 + // xul:menupopup 1.118 + role: ROLE_COMBOBOX_LIST, // context menu popup 1.119 + children: [] 1.120 + } 1.121 + ] 1.122 + }; 1.123 + 1.124 + // XPFE and Toolkit autocomplete widgets differ. 1.125 + var ac1h = document.getElementById("autocomplete"); 1.126 + if ("clearResults" in ac1h) { 1.127 + SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac1h)"); 1.128 + 1.129 + // Popup is always created. 1.130 + accTree.children.push( 1.131 + { 1.132 + // xul:panel 1.133 + role: ROLE_COMBOBOX_LIST, 1.134 + children: [ 1.135 + { 1.136 + // xul:tree 1.137 + role: ROLE_TABLE, 1.138 + children: [ 1.139 + { 1.140 + // xul:treecols 1.141 + role: ROLE_LIST, 1.142 + children: [ 1.143 + { 1.144 + // xul:treecol 1.145 + role: ROLE_COLUMNHEADER, 1.146 + children: [] 1.147 + } 1.148 + ] 1.149 + } 1.150 + ] 1.151 + } 1.152 + ] 1.153 + } 1.154 + ); 1.155 + } else { 1.156 + SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac1h)"); 1.157 + 1.158 + // Popup is lazily created, so not present in this case. 1.159 + } 1.160 + 1.161 + testAccessibleTree("autocomplete", accTree); 1.162 + 1.163 + ////////////////////////////////////////////////////////////////////////// 1.164 + // textbox@type=autocomplete #2 (child menupoup) 1.165 + 1.166 + accTree = { 1.167 + // textbox 1.168 + role: ROLE_AUTOCOMPLETE, 1.169 + children: [ 1.170 + { 1.171 + // menupopup 1.172 + role: ROLE_COMBOBOX_LIST, // autocomplete menu popup 1.173 + children: [ 1.174 + { 1.175 + // menuitem 1.176 + role: ROLE_COMBOBOX_OPTION, 1.177 + children: [] 1.178 + } 1.179 + ] 1.180 + }, 1.181 + { 1.182 + // html:input 1.183 + role: ROLE_ENTRY, 1.184 + children: [ 1.185 + // no text leaf accessible for text node 1.186 + ] 1.187 + }, 1.188 + { 1.189 + // xul:menupopup 1.190 + role: ROLE_COMBOBOX_LIST, // context menu popup 1.191 + children: [] 1.192 + } 1.193 + ] 1.194 + }; 1.195 + 1.196 + // XPFE and Toolkit autocomplete widgets differ. 1.197 + var ac2cmp = document.getElementById("autocomplete2"); 1.198 + if ("clearResults" in ac2cmp) { 1.199 + SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac2mp)"); 1.200 + 1.201 + // Popup is always created. 1.202 + accTree.children.push( 1.203 + { 1.204 + // xul:panel 1.205 + role: ROLE_COMBOBOX_LIST, 1.206 + children: [ 1.207 + { 1.208 + // xul:tree 1.209 + role: ROLE_TABLE, 1.210 + children: [ 1.211 + { 1.212 + // xul:treecols 1.213 + role: ROLE_LIST, 1.214 + children: [ 1.215 + { 1.216 + // xul:treecol 1.217 + role: ROLE_COLUMNHEADER, 1.218 + children: [] 1.219 + } 1.220 + ] 1.221 + } 1.222 + ] 1.223 + } 1.224 + ] 1.225 + } 1.226 + ); 1.227 + } else { 1.228 + SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac2mp)"); 1.229 + 1.230 + // Popup is lazily created, so not present in this case. 1.231 + } 1.232 + 1.233 + testAccessibleTree("autocomplete2", accTree); 1.234 + 1.235 + SimpleTest.finish() 1.236 + } 1.237 + 1.238 + SimpleTest.waitForExplicitFinish(); 1.239 + addA11yLoadEvent(doTest); 1.240 + ]]> 1.241 + </script> 1.242 + 1.243 + <hbox flex="1" style="overflow: auto;"> 1.244 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.245 + <a target="_blank" 1.246 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=249292" 1.247 + title="Ensure accessible children for toolbarbutton types 'menu' and 'menu-button'"> 1.248 + Mozilla Bug 249292 1.249 + </a> 1.250 + <a target="_blank" 1.251 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=626660" 1.252 + title="Cache rendered text on a11y side"> 1.253 + Mozilla Bug 626660 1.254 + </a><br/> 1.255 + <p id="display"></p> 1.256 + <div id="content" style="display: none"> 1.257 + </div> 1.258 + <pre id="test"> 1.259 + </pre> 1.260 + </body> 1.261 + 1.262 + <vbox flex="1"> 1.263 + <menulist id="menulist"> 1.264 + <menupopup> 1.265 + <menuitem label="item"/> 1.266 + <menuitem label="item"/> 1.267 + </menupopup> 1.268 + </menulist> 1.269 + 1.270 + <menulist id="menulist2" editable="true"> 1.271 + <menupopup> 1.272 + <menuitem label="item"/> 1.273 + <menuitem label="item"/> 1.274 + </menupopup> 1.275 + </menulist> 1.276 + 1.277 + <textbox id="autocomplete" type="autocomplete" 1.278 + autocompletesearch="history" 1.279 + value="http://mochi.test:8888/redirect-a11y.html"/> 1.280 + 1.281 + <textbox id="autocomplete2" type="autocomplete"> 1.282 + <menupopup> 1.283 + <menuitem label="item1"/> 1.284 + </menupopup> 1.285 + </textbox> 1.286 + </vbox> 1.287 + </hbox> 1.288 + 1.289 +</window>