Debian Codegraph @

dijit/tests/_BidiSupport/dynamicallyChangeTextDir/DynamicChangeTextDir.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>Textarea with _BidiSupport</title>
7
8 <style type="text/css">
9 @import "../../../../dojo/resources/dojo.css";
10 @import "../../../../dijit/themes/tundra/tundra.css";
11 </style>
12
13 <!-- required: dojo.js -->
14 <script type="text/javascript" src="../../../../dojo/dojo.js"
15 data-dojo-config="parseOnLoad: true, isDebug: true, has: { 'dojo-bidi': true }">
16 </script>
17
18 <script type="text/javascript">
19 dojo.require("dijit.form.Textarea");
20 dojo.require("dijit.form.TextBox");
21 dojo.require("dijit.form.SimpleTextarea");
22 dojo.require("dijit.layout.ContentPane");
23 dojo.require("dijit.layout.TabContainer");
24 dojo.require("dojo.parser");
25 dojo.require("doh.runner");
26 dojo.require("dijit.form.ComboBox");
27
28 dojo.ready(function(){
29 doh.register("parse", function(){
30 dojo.parser.parse();
31
32 programmaticTextareaLTR = new dijit.form.Textarea({
33 id: "blankTaP",
34 name: "blankTaP",
35 style:{width:"30em"},
36 textDir:"ltr",
37 value: ""
38 }, "blankTaP");
39
40 programmaticTextareaRTL = new dijit.form.Textarea({
41 id: "filledTaP",
42 name: "filledTaP",
43 style:{width:"30em"},
44 textDir:"ltr",
45 value: "created programmatically!"
46 }, "filledTaP");
47
48 programmaticSTaB = new dijit.form.SimpleTextarea({
49 id: "blankSTaP",
50 name: "blankSTaP",
51 style:{width:"30em"},
52 rows:"2",
53 textDir:"ltr",
54 value: ""
55 }, "blankSTaP");
56
57 programmaticSTaF = new dijit.form.SimpleTextarea({
58 id: "filledSTaP",
59 name: "filledSTaP",
60 style:{width:"30em"},
61 rows:"2",
62 textDir:"ltr",
63 value: "created programmatically!"
64 }, "filledSTaP");
65
66 programmaticTextBoxB = new dijit.form.TextBox({
67 id: "blankTbP",
68 name: "blankTbP",
69 style:{width:"30em"},
70 textDir:"ltr",
71 value: ""
72 }, "blankTbP");
73
74 programmaticTextBoxF = new dijit.form.TextBox({
75 id: "filledTbP",
76 name: "filledTbP",
77 style:{width:"30em"},
78 textDir:"ltr",
79 value: "\u05e0\u05d5\u05e6\u05e8\u0020\u05e4\u05e8\u05d5\u05d2\u05de\u05e8\u05d8\u05d9\u0021"
80 }, "filledTbP");
81 });
82
83 var blankTaP
84 , filledTaP
85 , blankTaM
86 , filledlTaM
87 , comboBM
88 , blankTbM
89 , filledTbM
90 , blankStaM
91 , filledStaM
92 , blankTbP
93 , filledTbP
94 , blankSTaP
95 , filledSTaP
96 , combo;
97
98 dijit.byId("comboBM").toggleDropDown();
99 dijit.byId("comboBM").closeDropDown();
100
101 doh.register("test dynamic change of textDir initial", [
102 {
103 name: "initial textDir of all the widgets",
104
105 setUp: function(){
106 blankTaP = dijit.byId("blankTaP");
107 filledTaP = dijit.byId("filledTaP");
108 blankTaM = dijit.byId("blankTaM");
109 filledlTaM = dijit.byId("filledlTaM");
110 comboBM = dijit.byId("comboBM");
111 blankTbM = dijit.byId("blankTbM");
112 filledTbM = dijit.byId("filledTbM");
113 blankStaM = dijit.byId("blankStaM");
114 filledStaM = dijit.byId("filledStaM");
115 blankTbP = dijit.byId("blankTbP");
116 filledTbP = dijit.byId("filledTbP");
117 blankSTaP = dijit.byId("blankSTaP");
118 filledSTaP = dijit.byId("filledSTaP");
119
120 combo = dijit.byId("comboBM");
121 },
122
123 runTest: function(){
124 doh.is("ltr",blankTaP.textDir, "direction of : blankTaP");
125 doh.is("ltr",filledTaP.textDir, "direction of : filledTaP");
126 doh.is("ltr",blankTaM.textDir, "direction of : blankTaM");
127 doh.is("ltr",filledlTaM.textDir, "direction of : filledlTaM");
128 doh.is("ltr",comboBM.textDir, "direction of : comboBM");
129 doh.is("ltr",blankTbM.textDir, "direction of : blankTbM");
130 doh.is("ltr",filledTbM.textDir, "direction of : filledTbM");
131 doh.is("ltr",blankStaM.textDir, "direction of : blankStaM");
132 doh.is("ltr",filledStaM.textDir, "direction of : filledStaM");
133 doh.is("ltr",blankTbP.textDir, "direction of : blankTbP");
134 doh.is("ltr",filledTbP.textDir, "direction of : filledTbP");
135 doh.is("ltr",blankSTaP.textDir, "direction of : blankSTaP");
136 doh.is("ltr",filledSTaP.textDir, "direction of : filledSTaP");
137
138 doh.is("ltr",combo.dropDown.textDir, "direction of : combo.dropDown");
139
140 var d = new doh.Deferred();
141
142 combo.toggleDropDown();
143 setTimeout(d.getTestCallback(function(){
144 //combo.toggleDropDown();
145 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
146 // so it will check only the options
147 if(node.item){
148 doh.is("ltr", node.dir, node.textContent);
149 }
150 });
151 }), 100);
152 return d;
153 },
154
155 tearDown:function(){
156 combo.closeDropDown();
157 }
158 }
159 ]);
160
161 doh.register("test dynamic change of textDir to RTL", [
162 {
163 name: "set textDir dynamically to RTL",
164
165 setUp: function(){
166 var buttonRTL = dojo.byId("swithchTD_RTL");
167 buttonRTL.click();
168 },
169
170 runTest: function(){
171
172 doh.is("rtl",blankTaP.textDir, "direction of : blankTaP");
173 doh.is("rtl",filledTaP.textDir, "direction of : filledTaP");
174 doh.is("rtl",blankTaM.textDir, "direction of : blankTaM");
175 doh.is("rtl",filledlTaM.textDir, "direction of : filledlTaM");
176 doh.is("rtl",comboBM.textDir, "direction of : comboBM");
177 doh.is("rtl",blankTbM.textDir, "direction of : blankTbM");
178 doh.is("rtl",filledTbM.textDir, "direction of : filledTbM");
179 doh.is("rtl",blankStaM.textDir, "direction of : blankStaM");
180 doh.is("rtl",filledStaM.textDir, "direction of : filledStaM");
181 doh.is("rtl",blankTbP.textDir, "direction of : blankTbP");
182 doh.is("rtl",filledTbP.textDir, "direction of : filledTbP");
183 doh.is("rtl",blankSTaP.textDir, "direction of : blankSTaP");
184 doh.is("rtl",filledSTaP.textDir, "direction of : filledSTaP");
185
186 doh.is("rtl",combo.dropDown.textDir, "direction of : combo.dropDown");
187 }
188 },
189 {
190 name: "check focusNode.dir == RTL",
191
192 runTest: function(){
193
194 doh.is("rtl",blankTaP.focusNode.dir, "direction of : blankTaP");
195 doh.is("rtl",filledTaP.focusNode.dir, "direction of : filledTaP");
196 doh.is("rtl",blankTaM.focusNode.dir, "direction of : blankTaM");
197 doh.is("rtl",filledlTaM.focusNode.dir, "direction of : filledlTaM");
198 doh.is("rtl",comboBM.focusNode.dir, "direction of : comboBM");
199 doh.is("rtl",blankTbM.focusNode.dir, "direction of : blankTbM");
200 doh.is("rtl",filledTbM.focusNode.dir, "direction of : filledTbM");
201 doh.is("rtl",blankStaM.focusNode.dir, "direction of : blankStaM");
202 doh.is("rtl",filledStaM.focusNode.dir, "direction of : filledStaM");
203 doh.is("rtl",blankTbP.focusNode.dir, "direction of : blankTbP");
204 doh.is("rtl",filledTbP.focusNode.dir, "direction of : filledTbP");
205 doh.is("rtl",blankSTaP.focusNode.dir, "direction of : blankSTaP");
206 doh.is("rtl",filledSTaP.focusNode.dir, "direction of : filledSTaP");
207
208 var d = new doh.Deferred();
209
210 combo.toggleDropDown();
211 setTimeout(d.getTestCallback(function(){
212 //combo.toggleDropDown();
213 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
214 // so it will check only the options
215 if(node.item){
216 doh.is("rtl", node.dir, node.textContent);
217 }
218 });
219 }), 100);
220 return d;
221 },
222
223 tearDown:function(){
224 combo.closeDropDown();
225 }
226
227 }
228 ]);
229
230 doh.register("test dynamic change of textDir to LTR", [
231 {
232 name: "set textDir dynamically to LTR",
233
234 setUp: function(){
235 var buttonLTR = dojo.byId("swithchTD_LTR");
236 buttonLTR.click();
237 },
238
239 runTest: function(){
240
241 doh.is("ltr",blankTaP.textDir, "direction of : blankTaP");
242 doh.is("ltr",filledTaP.textDir, "direction of : filledTaP");
243 doh.is("ltr",blankTaM.textDir, "direction of : blankTaM");
244 doh.is("ltr",filledlTaM.textDir, "direction of : filledlTaM");
245 doh.is("ltr",comboBM.textDir, "direction of : comboBM");
246 doh.is("ltr",blankTbM.textDir, "direction of : blankTbM");
247 doh.is("ltr",filledTbM.textDir, "direction of : filledTbM");
248 doh.is("ltr",blankStaM.textDir, "direction of : blankStaM");
249 doh.is("ltr",filledStaM.textDir, "direction of : filledStaM");
250 doh.is("ltr",blankTbP.textDir, "direction of : blankTbP");
251 doh.is("ltr",filledTbP.textDir, "direction of : filledTbP");
252 doh.is("ltr",blankSTaP.textDir, "direction of : blankSTaP");
253 doh.is("ltr",filledSTaP.textDir, "direction of : filledSTaP");
254
255 doh.is("ltr",combo.dropDown.textDir, "direction of : combo.dropDown");
256 }
257 },
258 {
259 name: "check focusNode.dir == LTR",
260
261 runTest: function(){
262
263 doh.is("ltr",blankTaP.focusNode.dir, "direction of : blankTaP");
264 doh.is("ltr",filledTaP.focusNode.dir, "direction of : filledTaP");
265 doh.is("ltr",blankTaM.focusNode.dir, "direction of : blankTaM");
266 doh.is("ltr",filledlTaM.focusNode.dir, "direction of : filledlTaM");
267 doh.is("ltr",comboBM.focusNode.dir, "direction of : comboBM");
268 doh.is("ltr",blankTbM.focusNode.dir, "direction of : blankTbM");
269 doh.is("ltr",filledTbM.focusNode.dir, "direction of : filledTbM");
270 doh.is("ltr",blankStaM.focusNode.dir, "direction of : blankStaM");
271 doh.is("ltr",filledStaM.focusNode.dir, "direction of : filledStaM");
272 doh.is("ltr",blankTbP.focusNode.dir, "direction of : blankTbP");
273 doh.is("ltr",filledTbP.focusNode.dir, "direction of : filledTbP");
274 doh.is("ltr",blankSTaP.focusNode.dir, "direction of : blankSTaP");
275 doh.is("ltr",filledSTaP.focusNode.dir, "direction of : filledSTaP");
276
277
278 var d = new doh.Deferred();
279
280 combo.toggleDropDown();
281 setTimeout(d.getTestCallback(function(){
282 //combo.toggleDropDown();
283 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
284 // so it will check only the options
285 if(node.item){
286 doh.is("ltr", node.dir, node.textContent);
287 }
288 });
289 }), 100);
290 return d;
291 },
292
293 tearDown:function(){
294 combo.closeDropDown();
295 }
296 }
297 ]);
298
299 doh.register("test dynamic change of textDir", [
300 {
301 name: "set textDir dynamically to auto",
302
303 setUp: function(){
304 var buttonAUTO = dojo.byId("switchTD_AUTO");
305 buttonAUTO.click();
306 },
307
308 runTest: function(){
309
310 doh.is("auto",blankTaP.textDir, "direction of : blankTaP");
311 doh.is("auto",filledTaP.textDir, "direction of : filledTaP");
312 doh.is("auto",blankTaM.textDir, "direction of : blankTaM");
313 doh.is("auto",filledlTaM.textDir, "direction of : filledlTaM");
314 doh.is("auto",comboBM.textDir, "direction of : comboBM");
315 doh.is("auto",blankTbM.textDir, "direction of : blankTbM");
316 doh.is("auto",filledTbM.textDir, "direction of : filledTbM");
317 doh.is("auto",blankStaM.textDir, "direction of : blankStaM");
318 doh.is("auto",filledStaM.textDir, "direction of : filledStaM");
319 doh.is("auto",blankTbP.textDir, "direction of : blankTbP");
320 doh.is("auto",filledTbP.textDir, "direction of : filledTbP");
321 doh.is("auto",blankSTaP.textDir, "direction of : blankSTaP");
322 doh.is("auto",filledSTaP.textDir, "direction of : filledSTaP");
323
324 doh.is("auto",combo.dropDown.textDir, "direction of : combo.dropDown");
325 }
326 },
327 {
328 name: "check focusNode.dir of textDir == AUTO",
329
330 runTest: function(){
331
332 doh.is(filledTaP._checkContextual(filledTaP.value),filledTaP.focusNode.dir, "direction of : filledTaP");
333 doh.is(filledlTaM._checkContextual(filledlTaM.value),filledlTaM.focusNode.dir, "direction of : filledlTaM");
334 doh.is(comboBM._checkContextual(comboBM.displayedValue),comboBM.focusNode.dir, "direction of : comboBM");
335 doh.is(filledTbM._checkContextual(filledTbM.value),filledTbM.focusNode.dir, "direction of : filledTbM");
336 doh.is(filledStaM._checkContextual(filledStaM.value),filledStaM.focusNode.dir, "direction of : filledStaM");
337 doh.is(filledTbP._checkContextual(filledTbP.value),filledTbP.focusNode.dir, "direction of : filledTbP");
338 doh.is(filledSTaP._checkContextual(filledSTaP.value),filledSTaP.focusNode.dir, "direction of : filledSTaP");
339
340 var d = new doh.Deferred();
341
342 combo.toggleDropDown();
343 setTimeout(d.getTestCallback(function(){
344 var contextualDir;
345
346 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
347 // so it will check only the options
348 if(node.item){
349 contextualDir = this.getTextDir(node.innerText || node.textContent || "");
350 doh.is(contextualDir, node.dir, node.innerText || node.textContent || "");
351 }
352 },combo);
353 }), 100);
354 return d;
355 },
356
357 tearDown:function(){
358 combo.closeDropDown();
359 }
360 }
361 ]);
362
363 doh.run();
364 });
365 </script>
366 </head>
367 <body class="tundra" data-dojo-textdir="ltr">
368 <h1 class="testTitle">Dynamically changed textDir.</h1>
369
370 <h2 class="testTitle">Textarea</h2>
371 <div class="testExample">
372 <table>
373 <tr>
374 <th>
375 <label for="filledlTaM">dijit.form.Textarea, initially filled, markup created</label>
376 <br>
377 <textarea data-dojo-type="dijit/form/Textarea" id="filledlTaM" data-dojo-props='textDir:"ltr", style:{width:"30em"}'>Hello world!</textarea>
378 <br>
379 </th>
380 <th>
381 <label >dijit.form.Textarea, initially filled, programmatically created:</label>
382 <br>
383 <textarea id="filledTaP"></textarea>
384 <br>
385 </th>
386 </tr>
387 <tr>
388 <th>
389 <label for="blankTaM">dijit.form.Textarea, initially blank:</label>
390 <br>
391 <textarea data-dojo-type="dijit/form/Textarea" id="blankTaM" data-dojo-props='textDir:"ltr", style:{width:"30em"}'></textarea>
392 <br>
393 </th>
394 <th>
395 <label for="blankTaP">dijit.form.Textarea, initially blank, programmatically created:</label>
396 <br>
397 <textarea id="blankTaP"></textarea>
398 <br>
399 </th>
400 </tr>
401 </table>
402 </div>
403 <br>
404 <br>
405
406 <h2 class="testTitle">TextBox</h2>
407 <div class="testExample">
408 <table>
409 <tr>
410 <th>
411 <label for="filledTbM">dijit.form.TextBox, initially filled, markup created:</label>
412 <br>
413 <input data-dojo-type="dijit/form/TextBox" id="filledTbM" data-dojo-props='name:"filledTbM", value:"blah.", style:{width:"30em"},textDir:"ltr"'/>
414 <br>
415 </th>
416 <th>
417 <label >dijit.form.TextBox, initially filled, programmatically created:</label>
418 <br>
419 <textarea id="filledTbP"></textarea>
420 <br>
421 </th>
422 </tr>
423 <tr>
424 <th>
425 <label for="blankTbM">dijit.form.TextBox, initially blank, markup created:</label>
426 <br>
427 <input data-dojo-type="dijit/form/TextBox" id="blankTbM" data-dojo-props='name:"blankTbM", style:{width:"30em"}, value:"", textDir:"ltr"'/>
428 <br>
429 </th>
430 <th>
431 <label for="blankTaP">dijit.form.Textarea, initially blank, programmatically created:</label>
432 <br>
433 <textarea id="blankTbP"></textarea>
434 <br>
435 </th>
436 </tr>
437 </table>
438 </div>
439 <br>
440 <br>
441 <h2 class="testTitle">SimpleTextarea</h2>
442 <br>
443 <div class="testExample">
444 <table>
445 <tr>
446 <th>
447 <label>dijit.form.SimpleTextarea, initially filled, markup created</label>
448 <br>
449 <textarea id="filledStaM" data-dojo-type="dijit/form/SimpleTextarea"
450 data-dojo-props='name:"filledStaM",rows:"2", style:{width:"30em"}
451 '>&#1513;&#1500;&#1493;&#1501; &#1506;&#1493;&#1500;&#1501;, &#1513;&#1500;&#1493;&#1501; &#1500;&#1499;&#1493;&#1500;&#1501; &#1488;&#1497;&#1503; &#1497;&#1493;&#1514;&#1512; &#1499;&#1497;&#1507; &#1502;&#1491;&#1493;&#1490;'&#1493;!
452 </textarea>
453 <br>
454 </th>
455 <th>
456 <label >dijit.form.SimpleTextarea, initially filled, programmatically created:</label>
457 <br>
458 <textarea id="filledSTaP"></textarea>
459 <br>
460 </th>
461 </tr>
462 <tr>
463 <th>
464 <label for="blankTbM">dijit.form.SimpleTextarea, initially blank, markup created:</label>
465 <br>
466 <textarea id="blankStaM" data-dojo-type="dijit/form/SimpleTextarea"
467 data-dojo-props='name:"blankStaM",rows:"2", style:{width:"30em"},
468 textDir:"ltr"'>
469 </textarea>
470 </th>
471 <th>
472 <label>dijit.form.Textarea, initially blank, programmatically created:</label>
473 <br>
474 <textarea id="blankSTaP"></textarea>
475 <br>
476 </th>
477 </tr>
478 </table>
479 </div>
480 <br>
481 <br>
482 <label for="comboBM">dijit.form.ComboBox, markup</label>
483 <br>
484 <select id="comboBM"
485 data-dojo-type="dijit/form/ComboBox"
486 data-dojo-props='name:"comboBM",
487 textDir:"ltr"'>
488 <option >Apples!</option>
489 <option >Oranges!</option>
490 <option selected>Pears!</option>
491 <option >&#1513;&#1500;&#1493;&#1501; &#1500;&#1499;&#1501;!</option>
492 <option >&#1514;&#1508;&#1493;&#1495; &#1488;&#1491;&#1502;&#1492;!</option>
493 </select>
494 <br>
495 <br>
496 <br>
497
498 <input id="swithchTD_RTL" type="button" value="change textDir 2 RTL"
499 onclick="dijit.byId('blankTaP').set('textDir','rtl');
500 dijit.byId('filledTaP').set('textDir','rtl');
501 dijit.byId('blankTaM').set('textDir','rtl');
502 dijit.byId('filledlTaM').set('textDir','rtl');
503 dijit.byId('comboBM').set('textDir','rtl');
504 dijit.byId('blankTbM').set('textDir','rtl');
505 dijit.byId('filledTbM').set('textDir','rtl');
506 dijit.byId('blankStaM').set('textDir','rtl');
507 dijit.byId('filledStaM').set('textDir','rtl');
508 dijit.byId('blankTbP').set('textDir','rtl');
509 dijit.byId('filledTbP').set('textDir','rtl');
510 dijit.byId('blankSTaP').set('textDir','rtl');
511 dijit.byId('filledSTaP').set('textDir','rtl');
512 "/>
513
514 <input id="swithchTD_LTR" type="button" value="change textDir 2 LTR"
515 onclick="dijit.byId('blankTaP').set('textDir','ltr');
516 dijit.byId('filledTaP').set('textDir','ltr');
517 dijit.byId('blankTaM').set('textDir','ltr');
518 dijit.byId('filledlTaM').set('textDir','ltr');
519 dijit.byId('comboBM').set('textDir','ltr');
520 dijit.byId('blankTbM').set('textDir','ltr');
521 dijit.byId('filledTbM').set('textDir','ltr');
522 dijit.byId('blankStaM').set('textDir','ltr');
523 dijit.byId('filledStaM').set('textDir','ltr');
524 dijit.byId('blankTbP').set('textDir','ltr');
525 dijit.byId('filledTbP').set('textDir','ltr');
526 dijit.byId('blankSTaP').set('textDir','ltr');
527 dijit.byId('filledSTaP').set('textDir','ltr');
528 "/>
529
530 <input id="switchTD_AUTO" type="button" value="change textDir 2 AUTO"
531 onclick="dijit.byId('blankTaP').set('textDir','auto');
532 dijit.byId('filledTaP').set('textDir','auto');
533 dijit.byId('blankTaM').set('textDir','auto');
534 dijit.byId('filledlTaM').set('textDir','auto');
535 dijit.byId('comboBM').set('textDir','auto');
536 dijit.byId('blankTbM').set('textDir','auto');
537 dijit.byId('filledTbM').set('textDir','auto');
538 dijit.byId('blankStaM').set('textDir','auto');
539 dijit.byId('filledStaM').set('textDir','auto');
540 dijit.byId('blankTbP').set('textDir','auto');
541 dijit.byId('filledTbP').set('textDir','auto');
542 dijit.byId('blankSTaP').set('textDir','auto');
543 dijit.byId('filledSTaP').set('textDir','auto');
544 "/>
545 </body>
546 </html>