test_dnd.html
3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>robot DnD Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
data-dojo-config="isDebug: true"></script>
<script type="text/javascript">
require(["doh", "dojo/dom", "dojo/query", "dojo/robotx", "dojo/domReady!"], function(doh, dom, query, robot){
var container1;
var container2;
var container3;
var container4;
var container5;
robot.initRobot('../test_dnd.html');
doh.register('dojox.robot.AutoGeneratedTestGroup',{
name: 'autotest0',
timeout: 10000,
setUp: function(){
container1=dom.byId('container1', robot.doc);
container2=query("div[data-dojo-id='c2']", robot.doc)[0];
container3=query("div[data-dojo-id='c3']", robot.doc)[0];
container4=query("div[data-dojo-id='c4']", robot.doc)[0];
container5=query("div[data-dojo-id='c5']", robot.doc)[0];
},
runTest: function(){
var count1=query("div", container1).length;
var count2=query("div", container2).length;
var d = new doh.Deferred();
robot.mouseMoveAt('dojoUnique13', 500, 500, 10, 10);
robot.mousePress({left:true}, 100);
robot.mouseMoveAt(container2, 100, 1000);
robot.mouseRelease({left:true}, 500);
robot.sequence(d.getTestCallback(function(){
var actual = query("> div", container1).length;
count1--;
doh.is(count1, actual, "Wrong number of items ("+actual+") in container 1 (expected " + count1 + ")");
var actual = query("> div", container2).length;
count2++;
doh.is(count2, actual, "Wrong number of items ("+actual+") in container 2 (expected " + count2 + ")");
}), 1000);
return d;
}
});
doh.register('dojox.robot.AutoGeneratedTestGroup',{
name: 'autotest1',
timeout: 10000,
runTest: function(){
var count1=query("> div", container1).length;
var count2=query("> div", container2).length;
var d = new doh.Deferred();
robot.mouseMoveAt('dojoUnique3', 500, 500, 10, 10);
robot.mousePress({left:true}, 500);
robot.mouseMoveAt(container1, 500, 1000);
robot.mouseRelease({left:true}, 500);
robot.sequence(d.getTestCallback(function(){
var actual = query("> div", container1).length;
count1++;
doh.is(count1, actual, "Wrong number of items ("+actual+") in container 1 (expected " + count1 + ")");
var actual = query("> div", container2).length;
doh.is(count2, actual, "Wrong number of items ("+actual+") in container 2 (expected " + count2 + ")");
}), 1000);
return d;
}
});
doh.register('dojox.robot.AutoGeneratedTestGroup',{
name: 'autotest2',
timeout: 10000,
runTest: function(){
var count2=query("> div", container2).length;
var count5=query("> div", container5).length;
var d = new doh.Deferred();
robot.mouseMoveAt('dojoUnique11', 500, 500, 10, 10);
robot.mousePress({left:true}, 500);
robot.mouseMoveAt(container2, 500, 1000);
robot.mouseRelease({left:true}, 500);
robot.sequence(d.getTestCallback(function(){
var actual = query("> div", container2).length;
doh.is(count2, actual, "Wrong number of items ("+actual+") in container 2 (expected " + count2 + ")");
var actual = query("> div", container5).length;
doh.is(count5, actual, "Wrong number of items ("+actual+") in container 5 (expected " + count5 + ")");
}), 1000);
return d;
}
});
doh.run();
});
</script>
</head>
</html>