Debian Codegraph @

dijit/tests/_BidiSupport/form/robot/SimpleTextarea.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 SimpleTextarea 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 doh.robot.initRobot('../test_SimpleTextarea.html');
21 var textarea;
22
23 var focusThenRun = function(widget, fcn){
24 if(!widget.focused){
25 var handler = widget.connect(widget, '_onFocus', function(){
26 widget.disconnect(handler);
27 setTimeout(fcn, 1);
28 });
29 widget.focus();
30 }else{
31 fcn();
32 }
33 };
34
35 doh.register("LTR textarea", [
36 {
37 name: "initial text direction of filled 'ltrSimpleTexarea'",
38
39 setUp: function(){
40 textarea = dijit.byId("ltrSimpleTexarea");
41 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
42 },
43
44 runTest: function(){
45 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
46 }
47 },
48 {
49 name: "write in English in 'ltrSimpleTexarea'",
50 timeout: 4000,
51
52 runTest: function(){
53 var d = new doh.Deferred();
54
55 focusThenRun(textarea, function(){
56 doh.robot.keyPress("a", 400, modifier);
57 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
58
59 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
60
61 doh.robot.sequence(d.getTestCallback(function(){
62 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
63 }), 800);
64 });
65
66 return d;
67 }
68 },
69 {
70 name: "paste Hebrew in 'ltrSimpleTexarea'",
71 timeout: 4000,
72
73 setUp: function(){
74 textarea = dijit.byId("ltrSimpleTexarea");
75 },
76
77 runTest: function(){
78 var d = new doh.Deferred();
79
80 focusThenRun(textarea, function(){
81 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
82
83 doh.robot.keyPress("a", 400, modifier);
84 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
85
86 doh.robot.keyPress("v", 300, modifier);
87 doh.robot.sequence(d.getTestCallback(function(){
88 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
89 }), 400);
90 });
91
92 return d;
93 }
94 }
95 ]);
96
97 doh.register("RTL textarea", [
98 {
99 name: "initial text direction of filled 'rtlSimpleTexarea'",
100
101 setUp: function(){
102 textarea = dijit.byId("rtlSimpleTexarea");
103 },
104
105 runTest: function(){
106 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
107 }
108 },
109 {
110 name: "write in English in 'rtlSimpleTexarea'",
111 timeout: 4000,
112
113 runTest: function(){
114 var d = new doh.Deferred();
115
116 focusThenRun(textarea, function(){
117 doh.robot.keyPress("a", 400, modifier);
118 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
119
120 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
121
122 doh.robot.sequence(d.getTestCallback(function(){
123 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
124 }), 800);
125 });
126
127 return d;
128 }
129 },
130 {
131 name: "paste Hebrew in 'rtlSimpleTexarea'",
132 timeout: 4000,
133
134 runTest: function(){
135 var d = new doh.Deferred();
136
137 focusThenRun(textarea, function(){
138 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
139
140 doh.robot.keyPress("a", 400, modifier);
141 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
142
143 doh.robot.keyPress("v", 300, modifier);
144 doh.robot.sequence(d.getTestCallback(function(){
145 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
146 }), 400);
147 });
148 return d;
149 }
150 }
151 ]);
152
153 doh.register("Contextual textarea", [
154 {
155 name: "initial text direction of filled 'contextualSimpleTexarea'",
156
157 setUp: function(){
158 textarea = dijit.byId("contextualSimpleTexarea");
159 },
160
161 runTest: function(){
162 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
163 }
164 },
165 {
166 name: "write in English in 'contextualSimpleTexarea'",
167 timeout: 4000,
168
169 runTest: function(){
170 var d = new doh.Deferred();
171
172 focusThenRun(textarea, function(){
173 doh.robot.keyPress("a", 400, modifier);
174 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
175
176 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 400);
177
178 doh.robot.sequence(d.getTestCallback(function(){
179 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
180 }), 500);
181 });
182
183 return d;
184 }
185 },
186 {
187 name: "text direction paste Hebrew before English",
188 timeout: 3000,
189
190 runTest: function(){
191 var d = new doh.Deferred(),
192 modifier = dojo.isMac ? {meta: true} : {ctrl: true},
193 textarea = dijit.byId("contextualSimpleTexarea");
194
195 focusThenRun(textarea, function(){
196 doh.robot.setClipboard("\u05d0\u05e0\u05d9\u0020\u05d0\u05d5\u05de\u05e8\u05ea\u003a\u0020");
197
198 dojo.isMac ? doh.robot.keyPress("a", 100, {ctrl:true}): doh.robot.keyPress(dojo.keys.HOME, 100, {});
199
200 doh.robot.keyPress("v", 400, modifier);
201 doh.robot.sequence(d.getTestCallback(function(){
202 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
203 }), 800);
204 });
205
206 return d;
207 }
208 }
209 ]);
210
211 doh.register("programmaticAuto textarea in the border container", [
212 {
213 name: "initial text direction of filled 'programmaticAuto'",
214
215 setUp: function(){
216 textarea = dijit.byId("programmaticAuto");
217 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
218 },
219
220 runTest: function(){
221 doh.is("auto",textarea.textDir,"direction of :" + textarea.id);
222 }
223 },
224 {
225 name: "write in English in 'programmaticAuto'",
226 timeout: 4000,
227
228 runTest: function(){
229 var d = new doh.Deferred();
230
231 focusThenRun(textarea, function(){
232 doh.robot.keyPress("a", 400, modifier);
233 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
234
235 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
236
237 doh.robot.sequence(d.getTestCallback(function(){
238 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
239 }), 800);
240 });
241
242 return d;
243 }
244 },
245 {
246 name: "paste Hebrew in 'programmaticAuto'",
247 timeout: 4000,
248
249 runTest: function(){
250 var d = new doh.Deferred();
251
252 focusThenRun(textarea, function(){
253 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
254
255 doh.robot.keyPress("a", 400, modifier);
256 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
257
258 doh.robot.keyPress("v", 300, modifier);
259 doh.robot.sequence(d.getTestCallback(function(){
260 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
261 }), 400);
262 });
263
264 return d;
265 }
266 }
267 ]);
268
269 doh.register("programmaticRTL textarea in the border container", [
270 {
271 name: "initial text direction of filled 'programmaticRTL'",
272
273 setUp: function(){
274 textarea = dijit.byId("programmaticRTL");
275 },
276
277 runTest: function(){
278 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
279 }
280 },
281 {
282 name: "write in English in 'programmaticRTL'",
283 timeout: 4000,
284
285 runTest: function(){
286 var d = new doh.Deferred();
287
288 focusThenRun(textarea, function(){
289 doh.robot.keyPress("a", 400, modifier);
290 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
291
292 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
293
294 doh.robot.sequence(d.getTestCallback(function(){
295 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
296 }), 800);
297 });
298
299 return d;
300 }
301 },
302 {
303 name: "paste Hebrew in 'programmaticRTL'",
304 timeout: 4000,
305
306 runTest: function(){
307 var d = new doh.Deferred();
308
309 focusThenRun(textarea, function(){
310 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
311
312 doh.robot.keyPress("a", 400, modifier);
313 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
314
315 doh.robot.keyPress("v", 300, modifier);
316 doh.robot.sequence(d.getTestCallback(function(){
317 doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
318 }), 400);
319 });
320 return d;
321 }
322 }
323 ]);
324
325 doh.register("programmaticLTR textarea in the border container", [
326 {
327 name: "initial text direction of filled 'programmaticLTR'",
328
329 setUp: function(){
330 textarea = dijit.byId("programmaticLTR");
331 },
332
333 runTest: function(){
334 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
335 }
336 },
337 {
338 name: "write in English in 'programmaticLTR'",
339 timeout: 4000,
340
341 runTest: function(){
342 var d = new doh.Deferred();
343
344 focusThenRun(textarea, function(){
345 doh.robot.keyPress("a", 400, modifier);
346 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
347
348 doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 400);
349
350 doh.robot.sequence(d.getTestCallback(function(){
351 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
352 }), 500);
353 });
354
355 return d;
356 }
357 },
358 {
359 name: "text direction paste Hebrew before English",
360 timeout: 3000,
361
362 runTest: function(){
363 var d = new doh.Deferred(),
364 modifier = dojo.isMac ? {meta: true} : {ctrl: true};
365
366 focusThenRun(textarea, function(){
367 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
368
369 doh.robot.keyPress("a", 400, modifier);
370 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
371
372 doh.robot.keyPress("v", 400, modifier);
373 doh.robot.sequence(d.getTestCallback(function(){
374 doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
375 }), 800);
376
377 });
378
379 return d;
380 }
381 }
382 ]);
383
384 doh.run();
385 });
386 </script>
387 </head>
388 </html>