Debian Codegraph @

dijit/tests/form/robot/Form_onsubmit.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 Form_onsubmit Test</title>
6
7 <style>
8 @import "../../../../util/doh/robot/robot.css";
9 </style>
10
11 <!-- required: dojo.js -->
12 <script type="text/javascript" src="../../../../dojo/dojo.js"></script>
13
14 <script type="text/javascript">
15 dojo.require("dijit.robotx");
16 dojo.require("dijit.tests.helpers"); // functions to help test
17
18 dojo.ready(function(){
19 doh.robot.initRobot('../test_Form_onsubmit.html');
20
21 var textbox;
22 var handler;
23 doh.register("onsubmit", [
24 {
25 name: "submit1",
26 timeout: 4000,
27 runTest: function(){
28 var d = new doh.Deferred();
29
30 textbox = dijit.byId("textbox");
31 //reset the submit textbox
32 textbox.set('value', "", false);
33 handler = textbox.connect(textbox, 'onChange', function(){
34 d.errback('onChange should not have fired');
35 });
36
37 doh.robot.mouseMoveAt("submit1", 1000, 1);
38 doh.robot.mouseClick({left:true}, 500);
39
40 doh.robot.sequence(d.getTestCallback(function(){
41 doh.is("", textbox.get('value'));
42 }), 1000);
43
44 return d;
45 },
46 tearDown: function(){
47 textbox.disconnect(handler);
48 }
49 },
50 {
51 name: "submit2",
52 timeout: 4000,
53 runTest: function(){
54 var d = new doh.Deferred();
55
56 //reset the submit textbox
57 textbox.set('value', "", false);
58 handler = textbox.connect(textbox, 'onChange', function(){
59 d.errback('onChange should not have fired');
60 });
61
62 doh.robot.mouseMoveAt("submit2", 0, 1);
63 doh.robot.mouseClick({left:true}, 500);
64
65 doh.robot.sequence(d.getTestCallback(function(){
66 doh.is("", textbox.get('value'));
67 }), 1000);
68
69 return d;
70 },
71 tearDown: function(){
72 textbox.disconnect(handler);
73 }
74 },
75 {
76 name: "submit3",
77 timeout: 5000,
78 runTest: function(){
79 var d = new doh.Deferred();
80
81 //reset the submit textbox
82 textbox.set('value', "", false);
83
84 handler = textbox.connect(textbox, 'onChange',
85 d.getTestCallback(function(){
86 doh.is("one", textbox.get('value'));
87 })
88 );
89 doh.robot.mouseMoveAt("submit3", 0, 1);
90 doh.robot.mouseClick({left:true}, 500);
91
92 return d;
93 },
94 tearDown: function(){
95 textbox.disconnect(handler);
96 }
97 },
98 {
99 name: "submit4",
100 timeout: 5000,
101 runTest: function(){
102 var d = new doh.Deferred();
103
104 //reset the submit textbox
105 textbox.set('value', "", false);
106
107 handler = textbox.connect(textbox, 'onChange',
108 d.getTestCallback(function(){
109 doh.is("one", textbox.get('value'));
110 })
111 );
112 doh.robot.mouseMoveAt("submit4", 0, 1);
113 doh.robot.mouseClick({left:true}, 500);
114
115 return d;
116 },
117 tearDown: function(){
118 textbox.disconnect(handler);
119 }
120 },
121 {
122 name: "testReset1",
123 timeout: 9000,
124 runTest: function(){
125 var d = new doh.Deferred();
126
127 doh.robot.mouseMoveAt("combo1", 0, 1);
128 doh.robot.mouseClick({left:true}, 500);
129 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
130 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
131 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
132 doh.robot.keyPress(dojo.keys.ENTER, 500, {});
133 doh.robot.mouseMoveAt("reset1", 500, 0);
134 doh.robot.mouseClick({left:true}, 500);
135
136 doh.robot.sequence(d.getTestCallback(function(){
137 doh.is("two", dijit.byId("combo1").value);
138 }), 1000);
139 return d;
140 }
141 },
142 {
143 name: "testReset2",
144 timeout: 9000,
145 runTest: function(){
146 var d = new doh.Deferred();
147
148 doh.robot.mouseMoveAt("combo2", 0, 1);
149 doh.robot.mouseClick({left:true}, 500);
150 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
151 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
152 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
153 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
154 doh.robot.keyPress(dojo.keys.ENTER, 500, {});
155 doh.robot.mouseMoveAt("reset2", 500, 0);
156 doh.robot.mouseClick({left:true}, 500);
157
158
159 doh.robot.sequence(d.getTestCallback(function(){
160 doh.is("three", dijit.byId("combo2").value);
161 }), 1000);
162 return d;
163 }
164 },
165 {
166 name: "testReset3",
167 timeout: 9000,
168 runTest: function(){
169 var d = new doh.Deferred();
170
171 doh.robot.mouseMoveAt("combo3", 0, 1);
172 doh.robot.mouseClick({left:true}, 500);
173 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
174 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
175 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
176 doh.robot.keyPress(dojo.keys.ENTER, 500, {});
177 doh.robot.mouseMoveAt("reset3", 500, 0);
178 doh.robot.mouseClick({left:true}, 500);
179
180 doh.robot.sequence(d.getTestCallback(function(){
181 doh.is("one", dijit.byId("combo3").value);
182 }), 1000);
183 return d;
184 }
185 },
186 {
187 name: "testReset4",
188 timeout: 9000,
189 runTest: function(){
190 var d = new doh.Deferred();
191
192 doh.robot.mouseMoveAt("combo4", 0, 1);
193 doh.robot.mouseClick({left:true}, 500);
194 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
195 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
196 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
197 doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
198 doh.robot.keyPress(dojo.keys.ENTER, 500, {});
199 doh.robot.mouseMoveAt("reset4", 500, 0);
200 doh.robot.mouseClick({left:true}, 500);
201
202
203 doh.robot.sequence(d.getTestCallback(function(){
204 doh.is("one", dijit.byId("combo4").value);
205 }), 1000);
206 return d;
207 }
208 }
209 ]);
210 doh.run();
211 });
212 </script>
213 </head>
214 </html>