|
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 textbox and textarea 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 <script type="application/javascript" |
|
17 src="../events.js" /> |
|
18 |
|
19 <script type="application/javascript"> |
|
20 <![CDATA[ |
|
21 //////////////////////////////////////////////////////////////////////////// |
|
22 // Test |
|
23 |
|
24 function doTest() |
|
25 { |
|
26 ////////////////////////////////////////////////////////////////////////// |
|
27 // textboxes |
|
28 |
|
29 var accTree = |
|
30 { SECTION: [ |
|
31 { ENTRY: [ { TEXT_LEAF: [] } ] }, |
|
32 { MENUPOPUP: [] } |
|
33 ] }; |
|
34 |
|
35 // default textbox |
|
36 testAccessibleTree("txc", accTree); |
|
37 |
|
38 // multiline |
|
39 testAccessibleTree("txc_multiline", accTree); |
|
40 |
|
41 ////////////////////////////////////////////////////////////////////////// |
|
42 // search textbox |
|
43 |
|
44 if (MAC) { |
|
45 accTree = |
|
46 { SECTION: [ |
|
47 { ENTRY: [ { TEXT_LEAF: [] } ] }, |
|
48 { MENUPOPUP: [] } |
|
49 ] }; |
|
50 } else { |
|
51 accTree = |
|
52 { SECTION: [ |
|
53 { ENTRY: [ { TEXT_LEAF: [] } ] }, |
|
54 { PUSHBUTTON: [] }, |
|
55 { MENUPOPUP: [] } |
|
56 ] }; |
|
57 } |
|
58 |
|
59 testAccessibleTree("txc_search", accTree); |
|
60 |
|
61 ////////////////////////////////////////////////////////////////////////// |
|
62 // number textbox |
|
63 |
|
64 accTree = |
|
65 { SECTION: [ |
|
66 { ENTRY: [ { TEXT_LEAF: [] } ] }, |
|
67 { MENUPOPUP: [] }, |
|
68 { PUSHBUTTON: [] }, |
|
69 { PUSHBUTTON: [] } |
|
70 ] }; |
|
71 |
|
72 testAccessibleTree("txc_number", accTree); |
|
73 |
|
74 ////////////////////////////////////////////////////////////////////////// |
|
75 // password textbox |
|
76 |
|
77 accTree = |
|
78 { SECTION: [ |
|
79 { PASSWORD_TEXT: [ { TEXT_LEAF: [] } ] }, |
|
80 { MENUPOPUP: [] } |
|
81 ] }; |
|
82 |
|
83 testAccessibleTree("txc_password", accTree); |
|
84 |
|
85 ////////////////////////////////////////////////////////////////////////// |
|
86 // autocomplete textbox |
|
87 |
|
88 accTree = { |
|
89 // textbox |
|
90 role: ROLE_AUTOCOMPLETE, |
|
91 children: [ |
|
92 { |
|
93 // html:input |
|
94 role: ROLE_ENTRY, |
|
95 children: [ |
|
96 { |
|
97 // #text |
|
98 role: ROLE_TEXT_LEAF, |
|
99 children: [] |
|
100 } |
|
101 ] |
|
102 }, |
|
103 { |
|
104 // xul:menupopup |
|
105 role: ROLE_COMBOBOX_LIST, |
|
106 children: [] |
|
107 } |
|
108 ] |
|
109 }; |
|
110 |
|
111 function test_AutocompleteControl() { |
|
112 testAccessibleTree("txc_autocomplete", accTree); |
|
113 SimpleTest.finish(); |
|
114 } |
|
115 |
|
116 // XPFE and Toolkit autocomplete widgets differ. |
|
117 var txc = document.getElementById("txc_autocomplete"); |
|
118 if ("clearResults" in txc) { |
|
119 SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget."); |
|
120 |
|
121 // Popup is always created. (See code below.) |
|
122 |
|
123 accTree.children.push( |
|
124 { |
|
125 // xul:panel |
|
126 role: ROLE_COMBOBOX_LIST, |
|
127 children: [ |
|
128 { |
|
129 // xul:tree |
|
130 role: ROLE_TABLE, |
|
131 children: [ |
|
132 { |
|
133 // xul:treecols |
|
134 role: ROLE_LIST, |
|
135 children: [ |
|
136 { |
|
137 // xul:treecol |
|
138 role: ROLE_COLUMNHEADER, |
|
139 children: [] |
|
140 } |
|
141 ] |
|
142 } |
|
143 ] |
|
144 } |
|
145 ] |
|
146 } |
|
147 ); |
|
148 test_AutocompleteControl(); |
|
149 |
|
150 } else { |
|
151 SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget."); |
|
152 |
|
153 // Dumb access to trigger popup lazy creation. |
|
154 waitForEvent(EVENT_REORDER, txc, test_AutocompleteControl); |
|
155 txc.popup; |
|
156 |
|
157 accTree.children.push( |
|
158 { |
|
159 role: ROLE_LIST, |
|
160 children: [ |
|
161 { |
|
162 role: ROLE_LIST, |
|
163 children: [ |
|
164 { |
|
165 role: ROLE_COLUMNHEADER, |
|
166 children: [] |
|
167 } |
|
168 ] |
|
169 } |
|
170 ] |
|
171 } |
|
172 ); |
|
173 } |
|
174 } |
|
175 |
|
176 SimpleTest.waitForExplicitFinish(); |
|
177 addA11yLoadEvent(doTest); |
|
178 ]]> |
|
179 </script> |
|
180 |
|
181 <hbox flex="1" style="overflow: auto;"> |
|
182 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
183 <a target="_blank" |
|
184 href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824" |
|
185 title="Create child accessibles for text controls from native anonymous content"> |
|
186 Mozilla Bug 542824 |
|
187 </a><br/> |
|
188 <p id="display"></p> |
|
189 <div id="content" style="display: none"> |
|
190 </div> |
|
191 <pre id="test"> |
|
192 </pre> |
|
193 </body> |
|
194 |
|
195 <vbox flex="1"> |
|
196 <textbox id="txc" value="hello"/> |
|
197 <textbox id="txc_search" type="search" value="hello"/> |
|
198 <textbox id="txc_number" type="number" value="44"/> |
|
199 <textbox id="txc_password" type="password" value="hello"/> |
|
200 <textbox id="txc_multiline" multiline="true" value="hello"/> |
|
201 <textbox id="txc_autocomplete" type="autocomplete" value="hello"/> |
|
202 </vbox> |
|
203 </hbox> |
|
204 |
|
205 </window> |