Debian Codegraph @

dijit/tests/_BidiSupport/form/robot/InlineEditBox.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 InlineEditBox 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_InlineEditBox.html');
21 var textbox;
22 var inlineBox;
23
24 function moveAndClick(node){
25 doh.robot.mouseMoveAt(node, 500, 1);
26 doh.robot.mouseClick({left: true}, 500);
27 }
28
29 doh.register("InlineEditBox with TextBox", [
30 {
31 name: "write in English in 'ltrInlineEditBox'",
32 timeout: 10000,
33
34 runTest: function(){
35 var d = new doh.Deferred();
36 inlineBox = dijit.byId("P0");
37 moveAndClick(inlineBox.domNode);
38 doh.robot.typeKeys("Hello!!!", 1000, 1200);
39
40 doh.robot.sequence(d.getTestCallback(function(){
41 textBox = inlineBox.wrapperWidget.editWidget;
42 doh.is('ltr', textBox.get("textDir"), "direction of :" + inlineBox.id);
43 doh.is('ltr', textBox.focusNode.dir, "direction of :" + inlineBox.id);
44 inlineBox.save(true);
45 }), 800);
46 return d;
47 }
48 },
49 {
50 name: "paste Hebrew in 'rtlInlineEditBox'",
51 timeout:10000,
52
53 runTest: function(){
54 var d = new doh.Deferred();
55 inlineBox = dijit.byId("P1");
56 moveAndClick(inlineBox.domNode);
57 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5!",'text/html');
58 var modifier = dojo.isMac ? {meta: true} : {ctrl: true};
59 doh.robot.keyPress("a", 400, modifier);
60 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
61 doh.robot.keyPress("v", 400, modifier);
62
63 doh.robot.sequence(d.getTestCallback(function(){
64 textBox = inlineBox.wrapperWidget.editWidget;
65 doh.is('rtl', textBox.get("textDir"), "direction of :" + inlineBox.id);
66 doh.is('rtl', textBox.focusNode.dir, "direction of :" + inlineBox.id);
67 inlineBox.save(true);
68 }), 800);
69 return d;
70 }
71 },
72 {
73 name: "initial text direction in 'autoInlineEditBox'",
74 timeout: 10000,
75
76 runTest: function(){
77 inlineBox = dijit.byId("P2");
78 doh.is('ltr', inlineBox.displayNode.dir, "direction of :" + inlineBox.id);
79 }
80
81 },
82 {
83 name: "change Value in 'autoInlineEditBox'",
84 timeout: 10000,
85
86 runTest: function(){
87 var d = new doh.Deferred();
88 inlineBox = dijit.byId("P2");
89
90 doh.robot.mouseMoveAt(function(){ return dojo.byId('button'); }, 500, 1000);
91 doh.robot.mouseClick({left: true}, 500);
92 moveAndClick(inlineBox.domNode);
93 doh.robot.sequence(d.getTestCallback(function(){
94 textBox = inlineBox.wrapperWidget.editWidget;
95 doh.is('auto', textBox.get("textDir"), "direction of :" + inlineBox.id);
96 doh.is('rtl', textBox.focusNode.dir, "direction of :" + inlineBox.id);
97 inlineBox.save(true);
98 }), 800);
99 return d;
100 }
101 }
102 ]);
103
104 doh.register("InlineEditBox with TextArea", [
105 {
106 name: "write in English in 'ltrInlineEditBox'",
107 timeout: 10000,
108
109 runTest: function(){
110 var d = new doh.Deferred();
111 inlineBox = dijit.byId("P3");
112 moveAndClick(inlineBox.domNode);
113 doh.robot.typeKeys("Hello!!!", 1000, 1200);
114
115 doh.robot.sequence(d.getTestCallback(function(){
116 textBox = inlineBox.wrapperWidget.editWidget;
117 doh.is('ltr', textBox.get("textDir"), "direction of :" + inlineBox.id);
118 doh.is('ltr', textBox.focusNode.dir, "direction of :" + inlineBox.id);
119 inlineBox.save(true);
120 }), 800);
121 return d;
122 }
123 },
124 {
125 name: "paste Hebrew in 'rtlInlineEditBox'",
126 timeout: 10000,
127
128 runTest: function(){
129 var d = new doh.Deferred();
130 inlineBox = dijit.byId("P4");
131 moveAndClick(inlineBox.domNode);
132 doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5!",'text/html');
133 var modifier = dojo.isMac ? {meta: true} : {ctrl: true};
134 doh.robot.keyPress("a", 400, modifier);
135 doh.robot.keyPress(dojo.keys.DELETE, 100, {});
136 doh.robot.keyPress("v", 400, modifier);
137
138 doh.robot.sequence(d.getTestCallback(function(){
139 textBox = inlineBox.wrapperWidget.editWidget;
140 doh.is('rtl', textBox.get("textDir"), "direction of :" + inlineBox.id);
141 doh.is('rtl', textBox.focusNode.dir, "direction of :" + inlineBox.id);
142 inlineBox.save(true);
143 }), 800);
144 return d;
145 }
146 },
147 {
148 name: "initial text direction in 'autoInlineEditBox'",
149 timeout: 10000,
150
151 runTest: function(){
152 var inlineBox = dijit.byId("P5");
153 doh.is('ltr', inlineBox.domNode.dir, "direction of :" + inlineBox.id);
154 }
155
156 },
157 {
158 name: "change Value in 'autoInlineEditBox'",
159 timeout: 10000,
160
161 runTest: function(){
162 var d = new doh.Deferred();
163 var inlineBox = dijit.byId("P5");
164 doh.robot.mouseMoveAt(function(){ return dojo.byId('Button1'); }, 500, 1000);
165
166 doh.robot.mouseClick({left: true}, 500);
167 moveAndClick(inlineBox.domNode);
168 doh.robot.sequence(d.getTestCallback(function(){
169 textBox = inlineBox.wrapperWidget.editWidget;
170 doh.is('auto', textBox.get("textDir"), "direction of :" + inlineBox.id);
171 doh.is('rtl', textBox.focusNode.dir, "direction of :" + inlineBox.id);
172 inlineBox.save(true);
173 }), 800);
174 return d;
175 }
176 }
177 ]);
178
179 doh.register("InlineEditBox with ComboBox", [
180 {
181 name: "test LTR ComboBox",
182 timeout: 10000,
183
184 runTest: function(){
185 var d = new doh.Deferred();
186 inlineBox = dijit.byId("combo1");
187 moveAndClick(inlineBox.domNode);
188 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 300);
189 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
190 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
191 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
192
193 doh.robot.sequence(d.getTestCallback(function(){
194 var combo = inlineBox.wrapperWidget.editWidget;
195 doh.is('ltr', combo.get("textDir"), "direction of :" + inlineBox.id);
196 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
197 if(node.item){
198 doh.is("ltr", node.dir, node.textContent);
199 }
200 });
201 inlineBox.save(true);
202 }), 900);
203 return d;
204 }
205 },
206 {
207 name: "test RTL ComboBox",
208 timeout: 10000,
209
210 runTest: function(){
211 var d = new doh.Deferred();
212 inlineBox = dijit.byId("combo2");
213 moveAndClick(inlineBox.domNode);
214 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 300);
215 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
216 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
217 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
218
219 doh.robot.sequence(d.getTestCallback(function(){
220 var combo = inlineBox.wrapperWidget.editWidget;
221 doh.is('rtl', combo.get("textDir"), "direction of :" + inlineBox.id);
222 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
223 if(node.item){
224 doh.is("rtl", node.dir, node.textContent);
225 }
226 });
227 inlineBox.save(true);
228 }), 900);
229 return d;
230 }
231 },
232 {
233 name: "test AUTO ComboBox",
234 timeout: 10000,
235
236 runTest: function(){
237 var d = new doh.Deferred();
238 inlineBox = dijit.byId("combo3");
239 moveAndClick(inlineBox.domNode);
240 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 300);
241 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
242 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
243 doh.robot.keyPress(dojo.keys.UP_ARROW, 300);
244
245 doh.robot.sequence(d.getTestCallback(function(){
246 var combo = inlineBox.wrapperWidget.editWidget;
247 doh.is('auto', combo.get("textDir"), "direction of :" + inlineBox.id);
248 dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
249 if(node.item){
250 var contextualDir = combo.getTextDir(node.innerText || node.textContent || "");
251 doh.is(contextualDir, node.dir, node.innerText || node.textContent || "");
252 }
253 });
254 inlineBox.save(true);
255 }), 900);
256 return d;
257 }
258 }
259 ]);
260 doh.run();
261 });
262 </script>
263 </head>
264 </html>