Debian Codegraph @

dijit/tests/editor/robot/Editor_bidi.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <title>doh.robot Editor GUI orientation and default text direction tests</title>
6
7 <style>
8 @import "../../../../util/doh/robot/robot.css";
9 </style>
10
11 <script type="text/javascript" src="../../../../dojo/dojo.js"></script>
12
13 <script type="text/javascript">
14 require([
15 "doh/runner", "dojo/robotx", "dojo/dom-style", "dojo/keys",
16 "dijit/tests/helpers", "dojo/domReady!"
17 ], function(doh, robot, domStyle, keys, helpers){
18
19 robot.initRobot('../test_bidiEditor.html');
20 var registry;
21 var editor1;
22
23 doh.register("setup", [
24 {
25 name: "wait for editors to load",
26 timeout: 5000,
27 runTest: helpers.waitForLoad
28 },
29 function setVars(){
30 registry = robot.window.require("dijit/registry");
31 }
32 ]);
33
34 doh.register("GUI orientation and default text direction tests", [
35 {
36 name: "Inherited LTR; Undefined",
37 timeout: 10000,
38 setUp: function(){
39 editor1 = registry.byId("ed1");
40 },
41 runTest: function(){
42 var d = new doh.Deferred();
43 setTimeout(d.getTestCallback(function(){
44 doh.is("ltr", domStyle.get(editor1.domNode,"direction"));
45 doh.is("ltr", domStyle.get(editor1.editNode,"direction"));
46 }), 3000);
47 editor1.focus();
48 robot.typeKeys("GUI orientation is inherited as left-to-right.",50,500);
49 robot.keyPress(keys.ENTER, 100);
50 robot.typeKeys("Text direction isn't defined explicitly.",50,500);
51 return d;
52 }
53 },
54 {
55 name: "Inherited RTL; Undefined",
56 timeout: 10000,
57 setUp: function(){
58 editor1 = registry.byId("ed2");
59 },
60 runTest: function(){
61 var d = new doh.Deferred();
62 setTimeout(d.getTestCallback(function(){
63 doh.is("rtl", domStyle.get(editor1.domNode,"direction"));
64 doh.is("rtl", domStyle.get(editor1.editNode,"direction"));
65 }), 3000);
66 editor1.focus();
67 robot.typeKeys("GUI orientation is inherited as right-to-left.",50,500);
68 robot.keyPress(keys.ENTER, 100);
69 robot.typeKeys("Text direction isn't defined explicitly.",50,500);
70 return d;
71 }
72 },
73
74 {
75 name: "dir=LTR; textDir=RTL",
76 timeout: 10000,
77 setUp: function(){
78 editor1 = registry.byId("ed3");
79 },
80 runTest: function(){
81 var d = new doh.Deferred();
82 setTimeout(d.getTestCallback(function(){
83 doh.is("ltr", domStyle.get(editor1.domNode,"direction"));
84 doh.is("rtl", domStyle.get(editor1.editNode,"direction"));
85 }), 2000);
86 editor1.focus();
87 robot.typeKeys("GUI orientation is set as left-to-right.",50,500);
88 robot.keyPress(keys.ENTER, 100);
89 robot.typeKeys("Text direction is set as right-to-left.",50,500);
90 return d;
91 }
92 },
93 {
94 name: "dir=RTL; textDir=LTR",
95 timeout: 10000,
96 setUp: function(){
97 editor1 = registry.byId("ed4");
98 },
99 runTest: function(){
100 var d = new doh.Deferred();
101 setTimeout(d.getTestCallback(function(){
102 doh.is("rtl", domStyle.get(editor1.domNode,"direction"));
103 doh.is("ltr", domStyle.get(editor1.editNode,"direction"));
104 }), 2000);
105 editor1.focus();
106 robot.typeKeys("GUI orientation is set as right-to-left.",50,500);
107 robot.keyPress(keys.ENTER, 100);
108 robot.typeKeys("Text direction is set as left-to-right.",50,500);
109 return d;
110 }
111 },
112 {
113 name: "Dir: LTR; TextDir: RTL (programmatic creation)",
114 timeout: 10000,
115 setUp: function(){
116 editor1 = registry.byId("prog1");
117 },
118 runTest: function(){
119 var d = new doh.Deferred();
120 setTimeout(d.getTestCallback(function(){
121 doh.is("ltr", domStyle.get(editor1.domNode,"direction"));
122 doh.is("rtl", domStyle.get(editor1.editNode,"direction"));
123 }), 2000);
124 editor1.focus();
125 robot.typeKeys("Editor is created with left-to-right direction,",50,500);
126 robot.keyPress(keys.ENTER, 100);
127 robot.typeKeys("its text direction is set to right-to-left.",50,500);
128 return d;
129 }
130 },
131 {
132 name: "Dir: RTL; TextDir: LTR (programmatic creation)",
133 timeout: 10000,
134 setUp: function(){
135 editor1 = registry.byId("prog2");
136 },
137 runTest: function(){
138 var d = new doh.Deferred();
139 setTimeout(d.getTestCallback(function(){
140 doh.is("rtl", domStyle.get(editor1.domNode,"direction"));
141 doh.is("ltr", domStyle.get(editor1.editNode,"direction"));
142 }), 2000);
143 editor1.focus();
144 robot.typeKeys("Editor is created with right-to-left direction,",50,500);
145 robot.keyPress(keys.ENTER, 100);
146 robot.typeKeys("its text direction is set to left-to-right.",50,500);
147 return d;
148 }
149 }
150 ]);
151 doh.run();
152 });
153 </script>
154 </head>
155 </html>