Debian Codegraph @

dojox/mdnd/tests/robot/test_dnd_dndToDojo.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_dndToDojo.html');
16
17 doh.register("test_dnd_dndToDojo",
18 [
19 {
20 name: "dndToDojoSource",
21 timeout:10000,
22 runTest: function(){
23
24 // Moves an item from a dojox source to a dojo
25 // target.
26
27 var d = new doh.Deferred();
28
29 var itemType1 = dojo.query(".dndItem[dndType=type1] > .dragHandle")[0];
30 var source = dojo.query(".dndArea")[0];
31 var dojoTarget = dojo.query(".dojoDndTarget")[0];
32
33 var sizeArea = source.childNodes.length
34
35 doh.robot.mouseMoveAt(itemType1, 200);
36 doh.robot.mousePress({left:true}, 200);
37 doh.robot.mouseMoveAt(dojoTarget, 200);
38 doh.robot.mouseRelease({left:true}, 200);
39
40 doh.robot.sequence(function(){
41 try{
42 doh.assertEqual(source.childNodes.length , sizeArea-1, "A child should be delete from dojox dnd area.");
43 d.callback(true);
44 }
45 catch(e){
46 d.errback(e);
47 }
48 }, 200);
49 return d;
50 }
51 },
52 {
53 name: "dndToDojoAcceptance",
54 timeout:10000,
55 runTest: function(){
56
57 // Tries to move an item from a dojox source to
58 // a dojo area :
59 // - Item's type : 2
60 // - Drop area accept types : 1
61 // -> In this case, drop is refused
62
63 var d = new doh.Deferred();
64
65 var itemType2 = dojo.query(".dndItem[dndType=type2] > .dragHandle")[0];
66 var source = dojo.query(".dndArea")[0];
67 var dojoTarget = dojo.query(".dojoDndTarget")[0];
68
69 var sizeArea = source.childNodes.length
70
71 doh.robot.mouseMoveAt(itemType2, 200);
72 doh.robot.mousePress({left:true}, 200);
73 doh.robot.mouseMoveAt(dojoTarget, 200);
74 doh.robot.mouseRelease({left:true}, 200);
75
76 doh.robot.sequence(function(){
77 try{
78 doh.assertEqual(source.childNodes.length ,sizeArea, "DnD restriction. No change !");
79 d.callback(true);
80 }
81 catch(e){
82 d.errback(e);
83 }
84 }, 200);
85
86 return d;
87 }
88 }
89 ]
90 );
91 doh.run();
92 });
93 </script>
94 <style type="text/css"></style>
95 </head>
96 <body>
97 </body>
98 </html>