Debian Codegraph @

dijit/tests/_BidiSupport/form/robot/SimpleComboBoxes.html

raw symbols SCIP
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>doh.robot ComboBox textDir Tests</title>
7
8 <style>
9 @import "../../../../../util/doh/robot/robot.css";
10 </style>
11
12 <!-- required: dojo.js -->
13 <script type="text/javascript" src="../../../../../dojo/dojo.js">
14 </script>
15
16 <script type="text/javascript">
17 dojo.require("dijit.robotx");
18
19 dojo.ready(function(){
20 var combo;
21
22 doh.robot.initRobot('../test_SimpleComboBoxes.html');
23
24 doh.register("Test LTR combo box", [
25 {
26 name: "check drop down items text direction.",
27 timeout: 6000,
28
29 setUp: function(){
30 combo = dijit.byId("fruitLtr");
31 doh.t(!!combo, "found fruitLtr");
32 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
33 },
34
35 runTest: function(){
36 var d = new doh.Deferred();
37
38 // Open drop down
39 doh.robot.sequence(d.getTestErrback(function(){
40 // delay is needed to work around IE bug
41 combo.focusNode.focus();
42 }), 50);
43 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
44
45 var handle = dojo.connect(combo, "openDropDown", function(){
46 handle.remove();
47 doh.robot.sequence(d.getTestCallback(function(){
48 doh.t(!!combo.dropDown, "dropdown exists");
49 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
50 // so it will check only the options
51 if(node.item){
52 doh.is("ltr", node.dir, node.textContent);
53 }
54 });
55 }), 50);
56 });
57
58 return d;
59 },
60
61 tearDown: function(){
62 combo.closeDropDown();
63 }
64 },
65 {
66 name: "paste English in 'fruitLtr'",
67 timeout: 3000,
68
69 runTest: function(){
70 var d = new doh.Deferred();
71
72 doh.robot.keyPress("a", 300, modifier);
73 doh.robot.keyPress(dojo.keys.DELETE, 300, {});
74 doh.robot.typeKeys("Hi!!!", 1, 300);
75 doh.robot.sequence(d.getTestCallback(function(){
76 doh.is("ltr", combo.focusNode.dir,"direction of : " + combo.id);
77 }), 300);
78
79 return d;
80 }
81 },
82 {
83 name: "paste Hebrew in 'fruitLtr'",
84 timeout: 3000,
85
86 runTest: function(){
87 var d = new doh.Deferred();
88
89 doh.robot.setClipboard("\u05e9\u05dc\u05d5\u05dd\u0021",'text/html');
90 doh.robot.keyPress("a", 300, modifier);
91 doh.robot.keyPress(dojo.keys.DELETE, 300, {});
92 doh.robot.keyPress("v", 300, modifier);
93 doh.robot.sequence(d.getTestCallback(function(){
94 doh.is("ltr", combo.focusNode.dir,"direction of : " + combo.id);
95 }), 300);
96
97 return d;
98 }
99 }
100 ]);
101
102 doh.register("Test RTL combo box", [
103 {
104 name: "check drop down items text direction.",
105 timeout: 3000,
106
107 setUp: function(){
108 combo = dijit.byId("fruitRtl");
109 doh.t(!!combo, "found fruitRtl");
110 },
111
112 runTest: function(){
113 var d = new doh.Deferred();
114 // Open drop down
115 combo.focusNode.focus();
116 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
117
118 var handle = dojo.connect(combo, "openDropDown", function(){
119 handle.remove();
120 doh.robot.sequence(d.getTestCallback(function(){
121 doh.t(!!combo.dropDown, "dropdown exists");
122 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
123 // so it will check only the options
124 if(node.item){
125 doh.is("rtl", node.dir, node.textContent);
126 }
127 });
128 }), 50);
129 });
130
131 return d;
132 },
133
134 tearDown: function(){
135 combo.closeDropDown();
136 }
137 },
138 {
139 name: "paste English in 'fruitRtl'",
140 timeout: 3000,
141
142 runTest: function(){
143 var d = new doh.Deferred();
144
145 doh.robot.keyPress("a", 300, modifier);
146 doh.robot.keyPress(dojo.keys.DELETE, 300, {});
147 doh.robot.typeKeys("Hi!!!", 1, 300);
148 doh.robot.sequence(d.getTestCallback(function(){
149 doh.is("rtl", combo.focusNode.dir,"direction of : " + combo.id);
150 }), 300);
151
152 return d;
153 }
154 },
155 {
156 name: "paste Hebrew in 'fruitRtl'",
157 timeout: 3000,
158
159 runTest: function(){
160 var d = new doh.Deferred();
161
162 doh.robot.setClipboard("\u05e9\u05dc\u05d5\u05dd\u0021",'text/html');
163 doh.robot.keyPress("a", 300, modifier);
164 doh.robot.keyPress(dojo.keys.DELETE, 300, {});
165 doh.robot.keyPress("v", 300, modifier);
166 doh.robot.sequence(d.getTestCallback(function(){
167 doh.is("rtl", combo.focusNode.dir,"direction of : " + combo.id);
168 }), 300);
169
170 return d;
171 }
172 }
173 ]);
174
175 doh.register("Test AUTO ComboBox", [
176 {
177 name: "check drop down items text direction.",
178 timeout: 60000,
179
180 setUp: function(){
181 combo = dijit.byId("fruitContextual");
182 doh.t(!!combo, "found fruitContextual");
183 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
184 },
185
186 runTest: function(){
187 var d = new doh.Deferred();
188
189 // Create drop down
190 combo.focusNode.focus();
191 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
192
193 var handle = dojo.connect(combo, "openDropDown", function(){
194 handle.remove();
195 doh.robot.sequence(d.getTestCallback(function(){
196 doh.t(!!combo.dropDown, "dropdown exists");
197 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
198 // so it will check only the options
199 if(node.item){
200 var contextualDir = this.getTextDir(node.innerText || node.textContent || "");
201 doh.is(contextualDir, node.dir, node.innerText || node.textContent || "");
202 }
203 }, combo);
204 }), 50);
205 });
206
207 return d;
208 },
209
210 tearDown: function(){
211 combo.closeDropDown();
212 }
213 },
214 {
215 name: "input field text direction for each item in the menu.",
216 timeout: 6000,
217
218 setUp: function(){
219 combo = dijit.byId("fruitContextual");
220 doh.t(!!combo, "found fruitContextual");
221 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
222 },
223
224 runTest: function(){
225 var d = new doh.Deferred();
226
227 combo.focusNode.focus();
228 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
229 doh.robot.sequence(d.getTestErrback(function(){
230 doh.is("ltr", combo.focusNode.dir, combo.id);
231 }), 200);
232
233 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 300);
234 doh.robot.sequence(d.getTestErrback(function(){
235 doh.is("ltr", combo.focusNode.dir, combo.id);
236 }), 200);
237
238 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
239 doh.robot.sequence(d.getTestErrback(function(){
240 doh.is("ltr", combo.focusNode.dir, combo.id);
241 }), 200);
242
243 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
244 doh.robot.sequence(d.getTestErrback(function(){
245 doh.is("ltr", combo.focusNode.dir, combo.id);
246 }), 200);
247
248 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
249 doh.robot.sequence(d.getTestErrback(function(){
250 doh.is("rtl", combo.focusNode.dir, combo.id);
251 }), 200);
252
253 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
254 doh.robot.sequence(d.getTestCallback(function(){
255 doh.is("rtl", combo.focusNode.dir, combo.id);
256 }), 200);
257
258 return d;
259 },
260
261 tearDown: function(){
262 combo.closeDropDown();
263 }
264 },
265 {
266 name: "text direction cut/paste English",
267 timeout: 3000,
268
269 runTest: function(){
270 var d = new doh.Deferred();
271
272 doh.robot.setClipboard("I am pasted!!!",'text/html');
273
274 doh.robot.keyPress("a", 500, modifier);
275 doh.robot.keyPress(dojo.keys.DELETE, 500, {});
276
277 doh.robot.keyPress("v", 500, modifier);
278 doh.robot.sequence(d.getTestCallback(function(){
279 doh.is("ltr", combo.focusNode.dir,"direction of : " + combo.id);
280 }), 300);
281
282 return d;
283 }
284 },
285 {
286 name: "text direction cut/paste Hebrew before English",
287 timeout: 3000,
288
289 runTest: function(){
290 var d = new doh.Deferred();
291
292 doh.robot.setClipboard("\u05d0\u05e0\u05d9\u003a\u0020",'text/html');
293
294 dojo.isMac ? doh.robot.keyPress("a", 100, {ctrl:true}): doh.robot.keyPress(dojo.keys.HOME, 100, {});
295
296 doh.robot.keyPress("v", 400, modifier);
297 doh.robot.sequence(d.getTestCallback(function(){
298 doh.is("rtl", combo.focusNode.dir,"direction of : " + combo.id);
299 }), 700);
300
301 return d;
302 }
303 }
304 ]);
305
306 doh.register("Test AUTO ComboBox", [
307 {
308 name: "test auto-completion popup and input field for 'auto'",
309 timeout: 30000,
310
311 setUp: function(){
312 autoCompleted = dijit.byId("fruitContextualAC");
313 doh.t(!!autoCompleted, "found fruitContextualAC");
314 },
315
316 runTest: function(){
317 var d = new doh.Deferred();
318 autoCompleted.focusNode.focus();
319
320 // Filter drop down list to entries starting with ":"
321 doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
322 doh.robot.keyPress(":", 100);
323
324 doh.robot.sequence(d.getTestErrback(function(){
325 doh.is("ltr", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
326 var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
327 doh.is("ltr", entries[1].dir, "list #1 - :");
328 doh.is("rtl", entries[2].dir, "list #2 - :");
329 }), 900);
330
331 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
332 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
333 doh.robot.sequence(d.getTestErrback(function(){
334 doh.is("rtl", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
335 }), 200);
336
337 doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
338 doh.robot.keyPress("@", 100);
339
340 doh.robot.sequence(d.getTestErrback(function(){
341 doh.is("ltr", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
342 var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
343 doh.is("ltr", entries[1].dir, "list #1 - @");
344 }), 900);
345
346 doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
347 doh.robot.keyPress("*", 100);
348
349 doh.robot.sequence(d.getTestCallback(function(){
350 doh.is("rtl", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
351 var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
352 doh.is("rtl", entries[1].dir, "list #1 - *");
353 }), 900);
354
355 return d;
356 }
357 },
358 {
359 name: "test auto-completion popup and input field for autoComplete:false",
360 timeout: 12000,
361
362 setUp: function(){
363 notAutoCompleted = dijit.byId("fruitContextual");
364 doh.t(!!notAutoCompleted, "found fruitContextual");
365 },
366
367 runTest: function(){
368 var d = new doh.Deferred();
369 notAutoCompleted.focusNode.focus();
370
371 // Filter drop down list to entries starting with ":"
372 doh.robot.sequence(function(){ notAutoCompleted.set("value", null); }, 400);
373 doh.robot.keyPress(":", 300);
374
375 doh.robot.sequence(d.getTestErrback(function(){
376 doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
377 notAutoCompleted.focusNode.dir, "false autoComplete - :");
378 var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
379 doh.is("ltr", entries[1].dir, "list #1 - :");
380 doh.is("rtl", entries[2].dir, "list #2 - :");
381 }), 900);
382
383 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
384 doh.robot.sequence(d.getTestErrback(function(){
385 doh.is("ltr", notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
386 }), 200);
387 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
388 doh.robot.sequence(d.getTestErrback(function(){
389 doh.is("rtl", notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
390 }), 200);
391
392 // Filter drop down list to entries starting with "@"
393 doh.robot.sequence(function(){
394 notAutoCompleted.set("value", null);
395 }, 400);
396 doh.robot.keyPress("@", 100);
397
398 doh.robot.sequence(d.getTestErrback(function(){
399 doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
400 notAutoCompleted.focusNode.dir, "false autoComplete - @");
401 var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
402 doh.is("ltr", entries[1].dir, "list #1 - @");
403 }), 900);
404
405 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
406 doh.robot.sequence(d.getTestErrback(function(){
407 doh.is("ltr", notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
408 }), 200);
409
410
411 // Filter drop down list to entries starting with "*"
412 doh.robot.sequence(function(){ notAutoCompleted.set("value", null); }, 400);
413 doh.robot.keyPress("*", 100);
414
415 doh.robot.sequence(d.getTestErrback(function(){
416 doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
417 notAutoCompleted.focusNode.dir, "false autoComplete - *");
418 var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
419 doh.is("rtl", entries[1].dir, "list #1 - *");
420 }), 900);
421
422 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
423 doh.robot.sequence(d.getTestCallback(function(){
424 doh.is("rtl", notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
425 }), 200);
426
427
428 return d;
429 }
430 }
431 ]);
432
433 doh.run();
434 });
435 </script>
436 </head>
437 </html>