1 | <html> |
---|
2 | <head> |
---|
3 | <style> |
---|
4 | @import "../robot/robot.css"; |
---|
5 | </style> |
---|
6 | <script src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true"></script> |
---|
7 | <script> |
---|
8 | require(["doh/runner", "doh/robot", "dojo/domReady!"], function(doh, robot){ |
---|
9 | var textbox = document.getElementById('textbox'); |
---|
10 | var BACKSPACE = 8; |
---|
11 | var END = 35; |
---|
12 | var LEFT_ARROW = 37; |
---|
13 | var SHIFT = 16; |
---|
14 | |
---|
15 | doh.register("robot", [ |
---|
16 | { |
---|
17 | name: "dojorobot1", |
---|
18 | timeout: 6900, |
---|
19 | setUp: function(){ |
---|
20 | textbox.value="hi"; |
---|
21 | }, |
---|
22 | runTest: function(){ |
---|
23 | var d = new doh.Deferred(); |
---|
24 | robot.mouseMove(30, 30, 500); |
---|
25 | robot.mouseClick({left: true}, 500); |
---|
26 | robot.typeKeys(" again", 500, 2500); |
---|
27 | robot.sequence(d.getTestCallback(function(){ |
---|
28 | doh.is("hi again", document.getElementById('textbox').value); |
---|
29 | }), 900); |
---|
30 | return d; |
---|
31 | } |
---|
32 | }, |
---|
33 | { |
---|
34 | name: "shiftarrow", |
---|
35 | timeout: 10000, |
---|
36 | setUp: function(){ |
---|
37 | textbox.value="hi again"; |
---|
38 | }, |
---|
39 | runTest: function(){ |
---|
40 | var d = new doh.Deferred(); |
---|
41 | robot.keyPress(END,500); |
---|
42 | // test shift+arrow with keyPress |
---|
43 | for(var i=0; i<3; i++){ |
---|
44 | robot.keyPress(LEFT_ARROW, 500, {shift: true}); |
---|
45 | } |
---|
46 | // test shift+arrow with keyDown then keyUp |
---|
47 | robot.keyDown(SHIFT,500); |
---|
48 | for(var i=0; i<3; i++){ |
---|
49 | robot.keyDown(LEFT_ARROW,500); |
---|
50 | robot.keyUp(LEFT_ARROW,20); |
---|
51 | } |
---|
52 | robot.keyUp(SHIFT,500); |
---|
53 | robot.keyPress(BACKSPACE,500); |
---|
54 | robot.sequence(d.getTestCallback(function(){ |
---|
55 | doh.is("hi", textbox.value); |
---|
56 | }), 900); |
---|
57 | return d; |
---|
58 | } |
---|
59 | } |
---|
60 | ]); |
---|
61 | doh.run(); |
---|
62 | }); |
---|
63 | </script> |
---|
64 | </head> |
---|
65 | <body> |
---|
66 | <form> |
---|
67 | <input type="text" value="hi" id="textbox" style="position:absolute; left:0px; top:20px; font-family:system;"></input> |
---|
68 | </form> |
---|
69 | </body> |
---|
70 | </html> |
---|