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