Debian Codegraph @

dojox/mdnd/tests/robot/test_dnd_overDropMode.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>OverDropMode</title>
4
5 <script type="text/javascript"
6 src="../../../../dojo/dojo.js"
7 data-dojo-config="isDebug: true">
8 </script>
9
10 <script type="text/javascript">
11 dojo.require("dijit.robotx");
12
13 dojo.addOnLoad(function(){
14
15 doh.robot.initRobot('../functionalTests/test_dnd_overDropMode.html');
16
17 doh.register("test_dnd_overDropMode",
18 [
19 {
20 name: "horizontalMovement",
21 timeout:10000,
22 runTest: function(){
23
24 // Tries to drag and drop an item between
25 // horizontal Dnd areas.
26
27 var d = new doh.Deferred();
28
29 var topLefArea = dojo.byId('topLeftArea');
30 var topRightArea = dojo.byId('topRightArea');
31
32 var itemA = dojo.query('#itemA > .dragHandle')[0];
33
34 var sizeA = topLefArea.childNodes.length;
35 var sizeB = topRightArea.childNodes.length;
36
37 doh.robot.mouseMoveAt(itemA,200);
38 doh.robot.mousePress({left:true}, 200);
39 doh.robot.mouseMoveAt(topRightArea,200);
40 doh.robot.mouseRelease({left:true}, 200);
41
42 doh.robot.sequence(function(){
43 try{
44 doh.assertEqual(topRightArea.childNodes.length, sizeB + 1, 'Item should be drop on top right area.');
45 doh.assertEqual(topLefArea.childNodes.length, sizeA - 1, 'Item should be remove from top left area.');
46 d.callback(true);
47 }
48 catch(e){
49 d.errback(e);
50 }
51 }, 200);
52 return d;
53 }
54 },
55 {
56 name: "verticalMovement",
57 timeout:10000,
58 runTest: function(){
59
60 // Tries to drag and drop an item between
61 // vertical Dnd areas.
62
63 var d = new doh.Deferred();
64
65 var topLefArea = dojo.byId('topLeftArea');
66 var bottomLeftArea = dojo.byId('bottomLeftArea');
67
68 var itemB = dojo.query('#itemB > .dragHandle')[0];
69
70 var sizeA = bottomLeftArea.childNodes.length;
71 var sizeB = topLefArea.childNodes.length;
72
73 doh.robot.mouseMoveAt(itemB,200);
74 doh.robot.mousePress({left:true}, 200);
75 doh.robot.mouseMoveAt(topLefArea,200);
76 doh.robot.mouseRelease({left:true}, 200);
77
78 doh.robot.sequence(function(){
79 try{
80 doh.assertEqual(topLefArea.childNodes.length, sizeB + 1, "Item should be drop on top left area.");
81 doh.assertEqual(bottomLeftArea.childNodes.length, sizeA - 1, "Item should be remove from bottom left area.");
82 d.callback(true);
83 }
84 catch(e){
85 d.errback(e);
86 }
87 }, 200);
88 return d;
89 }
90 },
91 {
92 name: "dropIndicator",
93 timeout:10000,
94 runTest: function(){
95
96 // Checks if the the dropIndicator is displayed.
97
98 var d = new doh.Deferred();
99
100 var topLefArea = dojo.byId('topLeftArea');
101 var topRightArea = dojo.byId('topRightArea');
102
103 var itemB = dojo.query('#itemB > .dragHandle')[0];
104
105 var sizeA = topLefArea.childNodes.length;
106 var sizeB = topRightArea.childNodes.length;
107
108 doh.robot.mouseMoveAt(itemB, 200);
109 doh.robot.mousePress({left:true}, 200);
110 doh.robot.mouseMoveAt(topRightArea, 200);
111
112 doh.robot.sequence(function(){
113 try{
114 doh.assertEqual(topLefArea.childNodes.length, sizeA - 1, "Item should be remove from top left area.");
115 doh.assertEqual(topRightArea.childNodes.length, sizeB + 1, "An item should be add to top right area.");
116 doh.assertEqual(dojo.query('.dropIndicator').length, 1, "Item added should be a drop indicator.");
117 d.callback(true);
118 }
119 catch(e){
120 d.errback(e);
121 }
122 },
123 200);
124 doh.robot.mouseRelease({left:true}, 200);
125 return d;
126 }
127 }
128 ]
129 );
130 doh.run();
131 });
132 </script>
133 </head>
134 <body>
135 </body>
136 </html>