accessible/tests/mochitest/tree/test_combobox.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessible XUL menulist and textbox @autocomplete hierarchy tests">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../common.js" />
michael@0 14 <script type="application/javascript"
michael@0 15 src="../role.js" />
michael@0 16
michael@0 17 <script type="application/javascript">
michael@0 18 <![CDATA[
michael@0 19 ////////////////////////////////////////////////////////////////////////////
michael@0 20 // Test
michael@0 21
michael@0 22 function doTest()
michael@0 23 {
michael@0 24 //////////////////////////////////////////////////////////////////////////
michael@0 25 // menulist
michael@0 26
michael@0 27 var accTree = {
michael@0 28 role: ROLE_COMBOBOX,
michael@0 29 children: [
michael@0 30 {
michael@0 31 role: ROLE_COMBOBOX_LIST,
michael@0 32 children: [
michael@0 33 {
michael@0 34 role: ROLE_COMBOBOX_OPTION,
michael@0 35 children: []
michael@0 36 },
michael@0 37 {
michael@0 38 role: ROLE_COMBOBOX_OPTION,
michael@0 39 children: []
michael@0 40 }
michael@0 41 ]
michael@0 42 }
michael@0 43 ]
michael@0 44 };
michael@0 45
michael@0 46 if (!MAC) {
michael@0 47 testAccessibleTree("menulist", accTree);
michael@0 48 } else {
michael@0 49 todo(false, "Make this test pass on OSX (bug 650366)");
michael@0 50 }
michael@0 51
michael@0 52 //////////////////////////////////////////////////////////////////////////
michael@0 53 // editable menulist
michael@0 54
michael@0 55 accTree = {
michael@0 56 role: ROLE_COMBOBOX,
michael@0 57 children: [
michael@0 58 {
michael@0 59 role: ROLE_ENTRY,
michael@0 60 children: [
michael@0 61 // no text leaf accessible for text node
michael@0 62 ]
michael@0 63 },
michael@0 64 {
michael@0 65 role: ROLE_COMBOBOX_LIST, // context menu
michael@0 66 children: []
michael@0 67 },
michael@0 68 {
michael@0 69 role: ROLE_PUSHBUTTON, // dropmarker
michael@0 70 children: []
michael@0 71 },
michael@0 72 {
michael@0 73 role: ROLE_COMBOBOX_LIST, // option list
michael@0 74 children: [
michael@0 75 {
michael@0 76 role: ROLE_COMBOBOX_OPTION,
michael@0 77 children: []
michael@0 78 },
michael@0 79 {
michael@0 80 role: ROLE_COMBOBOX_OPTION,
michael@0 81 children: []
michael@0 82 }
michael@0 83 ]
michael@0 84 }
michael@0 85 ]
michael@0 86 };
michael@0 87
michael@0 88 if (!MAC) {
michael@0 89 testAccessibleTree("menulist2", accTree);
michael@0 90 } else {
michael@0 91 todo(false, "Make this test pass on OSX (bug 551957)");
michael@0 92 }
michael@0 93
michael@0 94 //////////////////////////////////////////////////////////////////////////
michael@0 95 // textbox@type=autocomplete #1 (history)
michael@0 96
michael@0 97 accTree = {
michael@0 98 // textbox
michael@0 99 role: ROLE_AUTOCOMPLETE,
michael@0 100 children: [
michael@0 101 {
michael@0 102 // html:input
michael@0 103 role: ROLE_ENTRY,
michael@0 104 children: [
michael@0 105 {
michael@0 106 // #text
michael@0 107 role: ROLE_TEXT_LEAF,
michael@0 108 name: "http://mochi.test:8888/redirect-a11y.html",
michael@0 109 children: []
michael@0 110 }
michael@0 111 ]
michael@0 112 },
michael@0 113 {
michael@0 114 // xul:menupopup
michael@0 115 role: ROLE_COMBOBOX_LIST, // context menu popup
michael@0 116 children: []
michael@0 117 }
michael@0 118 ]
michael@0 119 };
michael@0 120
michael@0 121 // XPFE and Toolkit autocomplete widgets differ.
michael@0 122 var ac1h = document.getElementById("autocomplete");
michael@0 123 if ("clearResults" in ac1h) {
michael@0 124 SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac1h)");
michael@0 125
michael@0 126 // Popup is always created.
michael@0 127 accTree.children.push(
michael@0 128 {
michael@0 129 // xul:panel
michael@0 130 role: ROLE_COMBOBOX_LIST,
michael@0 131 children: [
michael@0 132 {
michael@0 133 // xul:tree
michael@0 134 role: ROLE_TABLE,
michael@0 135 children: [
michael@0 136 {
michael@0 137 // xul:treecols
michael@0 138 role: ROLE_LIST,
michael@0 139 children: [
michael@0 140 {
michael@0 141 // xul:treecol
michael@0 142 role: ROLE_COLUMNHEADER,
michael@0 143 children: []
michael@0 144 }
michael@0 145 ]
michael@0 146 }
michael@0 147 ]
michael@0 148 }
michael@0 149 ]
michael@0 150 }
michael@0 151 );
michael@0 152 } else {
michael@0 153 SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac1h)");
michael@0 154
michael@0 155 // Popup is lazily created, so not present in this case.
michael@0 156 }
michael@0 157
michael@0 158 testAccessibleTree("autocomplete", accTree);
michael@0 159
michael@0 160 //////////////////////////////////////////////////////////////////////////
michael@0 161 // textbox@type=autocomplete #2 (child menupoup)
michael@0 162
michael@0 163 accTree = {
michael@0 164 // textbox
michael@0 165 role: ROLE_AUTOCOMPLETE,
michael@0 166 children: [
michael@0 167 {
michael@0 168 // menupopup
michael@0 169 role: ROLE_COMBOBOX_LIST, // autocomplete menu popup
michael@0 170 children: [
michael@0 171 {
michael@0 172 // menuitem
michael@0 173 role: ROLE_COMBOBOX_OPTION,
michael@0 174 children: []
michael@0 175 }
michael@0 176 ]
michael@0 177 },
michael@0 178 {
michael@0 179 // html:input
michael@0 180 role: ROLE_ENTRY,
michael@0 181 children: [
michael@0 182 // no text leaf accessible for text node
michael@0 183 ]
michael@0 184 },
michael@0 185 {
michael@0 186 // xul:menupopup
michael@0 187 role: ROLE_COMBOBOX_LIST, // context menu popup
michael@0 188 children: []
michael@0 189 }
michael@0 190 ]
michael@0 191 };
michael@0 192
michael@0 193 // XPFE and Toolkit autocomplete widgets differ.
michael@0 194 var ac2cmp = document.getElementById("autocomplete2");
michael@0 195 if ("clearResults" in ac2cmp) {
michael@0 196 SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac2mp)");
michael@0 197
michael@0 198 // Popup is always created.
michael@0 199 accTree.children.push(
michael@0 200 {
michael@0 201 // xul:panel
michael@0 202 role: ROLE_COMBOBOX_LIST,
michael@0 203 children: [
michael@0 204 {
michael@0 205 // xul:tree
michael@0 206 role: ROLE_TABLE,
michael@0 207 children: [
michael@0 208 {
michael@0 209 // xul:treecols
michael@0 210 role: ROLE_LIST,
michael@0 211 children: [
michael@0 212 {
michael@0 213 // xul:treecol
michael@0 214 role: ROLE_COLUMNHEADER,
michael@0 215 children: []
michael@0 216 }
michael@0 217 ]
michael@0 218 }
michael@0 219 ]
michael@0 220 }
michael@0 221 ]
michael@0 222 }
michael@0 223 );
michael@0 224 } else {
michael@0 225 SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac2mp)");
michael@0 226
michael@0 227 // Popup is lazily created, so not present in this case.
michael@0 228 }
michael@0 229
michael@0 230 testAccessibleTree("autocomplete2", accTree);
michael@0 231
michael@0 232 SimpleTest.finish()
michael@0 233 }
michael@0 234
michael@0 235 SimpleTest.waitForExplicitFinish();
michael@0 236 addA11yLoadEvent(doTest);
michael@0 237 ]]>
michael@0 238 </script>
michael@0 239
michael@0 240 <hbox flex="1" style="overflow: auto;">
michael@0 241 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 242 <a target="_blank"
michael@0 243 href="https://bugzilla.mozilla.org/show_bug.cgi?id=249292"
michael@0 244 title="Ensure accessible children for toolbarbutton types 'menu' and 'menu-button'">
michael@0 245 Mozilla Bug 249292
michael@0 246 </a>
michael@0 247 <a target="_blank"
michael@0 248 href="https://bugzilla.mozilla.org/show_bug.cgi?id=626660"
michael@0 249 title="Cache rendered text on a11y side">
michael@0 250 Mozilla Bug 626660
michael@0 251 </a><br/>
michael@0 252 <p id="display"></p>
michael@0 253 <div id="content" style="display: none">
michael@0 254 </div>
michael@0 255 <pre id="test">
michael@0 256 </pre>
michael@0 257 </body>
michael@0 258
michael@0 259 <vbox flex="1">
michael@0 260 <menulist id="menulist">
michael@0 261 <menupopup>
michael@0 262 <menuitem label="item"/>
michael@0 263 <menuitem label="item"/>
michael@0 264 </menupopup>
michael@0 265 </menulist>
michael@0 266
michael@0 267 <menulist id="menulist2" editable="true">
michael@0 268 <menupopup>
michael@0 269 <menuitem label="item"/>
michael@0 270 <menuitem label="item"/>
michael@0 271 </menupopup>
michael@0 272 </menulist>
michael@0 273
michael@0 274 <textbox id="autocomplete" type="autocomplete"
michael@0 275 autocompletesearch="history"
michael@0 276 value="http://mochi.test:8888/redirect-a11y.html"/>
michael@0 277
michael@0 278 <textbox id="autocomplete2" type="autocomplete">
michael@0 279 <menupopup>
michael@0 280 <menuitem label="item1"/>
michael@0 281 </menupopup>
michael@0 282 </textbox>
michael@0 283 </vbox>
michael@0 284 </hbox>
michael@0 285
michael@0 286 </window>

mercurial