blob: 2f8f2b2b9b743c412f71d05b4771893cde2e0793 (
plain)
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>
<html lang="en">
<head>
<title>Draggable - Automated Test Page</title>
<script type="text/javascript" src="../../jquery/jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/source/ui.core.js"></script>
<script type="text/javascript" src="../../ui/source/ui.draggable.js"></script>
<script type="text/javascript" src="ui.testmouse.js"></script>
<style type="text/css">
html, body { height: 100%; }
#main { height: 100%; }
.drag { position: relative; margin: 10px; padding: 10px; border: 3px solid black; cursor: move; width: 200px; height: 40px; background: #eef; }
</style>
<script type="text/javascript">
</script>
<script type="text/javascript">
$(function() {
$(".drag").draggable().testMouse({
speed: "fast"
});
var queue;
var start = function() {
queue = tests.slice(); // clone
$("#status").text("Running...");
nextTest();
}
var stop = function() {
$("#status").text("Ready");
}
var tests = [];
var nextTest = function() {
if (queue.length) {
queue.pop().apply();
} else {
stop();
}
}
var addTest = function(fn) {
tests.unshift(fn);
}
addTest(function() {
$("#d1").testMouse("drag", 100, 0, nextTest);
});
addTest(function() {
$("#d2").testMouse("drag", 100, 0, nextTest);
});
addTest(function() {
$("#d3").testMouse("drag", 100, 0, nextTest);
});
$('#begin').click(function(e) {
start();
});
});
</script>
</head>
<body>
<div id="main">
<h1>jQuery UI Draggable - Automated Test</h1>
Status: <span id="status">Ready</span>
<div style="height: 3em;"><button id="begin">Run Test</button></div>
<div class="drag" id="d1">
Drag 1
</div>
<div class="drag" id="d2">
Drag 2
</div>
<div class="drag" id="d3">
Drag 3
</div>
</div>
</body>
</html>
|