Debian Codegraph @

dojox/mdnd/tests/robot/test_dnd_dndFromDojo.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>Robot - Adapter - DndFromDojo</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_dndFromDojo.html');
16
17 doh.register("test_dnd_dndFromDojo",
18 [
19 {
20 name: "dndFromPureSource",
21 timeout:6000,
22 runTest: function(){
23
24 // Moves an item from a dojo source to a dojox
25 // target.
26
27 var d = new doh.Deferred();
28
29 var itemType1 = dojo.query("#dojoPureSource > [dndType*=type1]")[0];
30 var area = dojo.query(".dndArea")[0];
31
32 var sizeArea = area.childNodes.length
33 doh.robot.mouseMoveAt(itemType1, 100);
34 doh.robot.mousePress({left:true}, 100);
35 doh.robot.mouseMoveAt(area, 100);
36 doh.robot.mouseRelease({left:true}, 100);
37
38 doh.robot.sequence(function(){
39 try{
40 doh.assertEqual(area.childNodes.length ,sizeArea + 1, "A child should be drop in the dojox area.");
41 d.callback(true);
42 }
43 catch(e){
44 d.errback(e);
45 }
46 }, 100);
47 return d;
48 }
49 },
50 {
51 name: "dndFromDojoSource",
52 timeout:10000,
53 runTest: function(){
54
55 // Moves an item from a dojo source/target to a
56 // dojox target.
57
58 var d = new doh.Deferred();
59
60 var itemType1 = dojo.query("#dojoSource > [dndType*=type1]")[0];
61 var area = dojo.query(".dndArea")[0];
62
63 var sizeArea = area.childNodes.length
64 doh.robot.mouseMoveAt(itemType1, 200);
65 doh.robot.mousePress({left:true}, 200);
66 doh.robot.mouseMoveAt(area, 200);
67 doh.robot.mouseRelease({left:true}, 200);
68
69 doh.robot.sequence(function(){
70 try{
71 doh.assertEqual(area.childNodes.length ,sizeArea + 1, "A child should be drop in the dojox area.");
72 d.callback(true);
73 }
74 catch(e){
75 d.errback(e);
76 }
77 }, 200);
78 return d;
79 }
80 },
81 {
82 name: "dndAcceptanceFromPureSource",
83 timeout:10000,
84 runTest: function(){
85
86 // Tries to move an item from a dojo source to a
87 // dojox areas :
88 // - Item's type : 2
89 // - Drop area accept types : 1
90 // -> In this case, drop is refused
91
92 var d = new doh.Deferred();
93
94 var itemType2 = dojo.query("#dojoPureSource > [dndType*=type2]")[0];
95 var area = dojo.query(".dndArea")[0];
96
97 var sizeArea = area.childNodes.length
98 doh.robot.mouseMoveAt(itemType2, 200);
99 doh.robot.mousePress({left:true}, 200);
100 doh.robot.mouseMoveAt(area, 200);
101 doh.robot.mouseRelease({left:true}, 200);
102
103 doh.robot.sequence(function(){
104 try{
105 doh.assertEqual(area.childNodes.length ,sizeArea, "A type 2 item should not be drop in the dojox area.");
106 d.callback(true);
107 }
108 catch(e){
109 d.errback(e);
110 }
111 }, 200);
112 return d;
113 }
114 },
115 {
116 name: "dndAcceptanceFromDojoSource",
117 timeout:10000,
118 runTest: function(){
119
120 // Tries to move an item from a dojo source/target
121 // to a dojox area :
122 // - Item's type : 2
123 // - Drop area accept types : 1
124 // -> In this case, drop is refused
125
126 var d = new doh.Deferred();
127
128 var itemType2 = dojo.query("#dojoSource > [dndType*=type2]")[0];
129 var area = dojo.query(".dndArea")[0];
130
131 var sizeArea = area.childNodes.length
132
133 doh.robot.mouseMoveAt(itemType2, 200);
134 doh.robot.mousePress({left:true}, 200);
135 doh.robot.mouseMoveAt(area, 200);
136 doh.robot.mouseRelease({left:true}, 200);
137
138 doh.robot.sequence(function(){
139 try{
140 doh.assertEqual(area.childNodes.length ,sizeArea, "A type 2 item should not be drop in the dojox area.");
141 d.callback(true);
142 }
143 catch(e){
144 d.errback(e);
145 }
146 }, 200);
147 doh.robot.mouseRelease({left:true}, 200);
148 return d;
149 }
150 }
151 ]
152 );
153 doh.run();
154 });
155 </script>
156 <style type="text/css"></style>
157 </head>
158 <body>
159 </body>
160 </html>