forked from PencilCode/jquery-turtle
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstop.html
More file actions
31 lines (31 loc) · 738 Bytes
/
stop.html
File metadata and controls
31 lines (31 loc) · 738 Bytes
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
<script src="lib/qunit.js"></script>
<link href="lib/qunit.css" rel="stylesheet">
<script src="lib/jquery.js"></script>
<script src="../jquery-turtle.js"></script>
<body>
<div id="qunit"></div>
<script>
eval($.turtle());
module("Stop test.");
asyncTest("Moves a turtle forever until off the screen", function() {
// Forever loop every 10ms.
forever(100, function() {
fd(100);
if (!inside(window)) {
stop();
stopped();
}
});
function stopped() {
ok(!inside(window));
speed(Infinity);
// Wait 50ms. forever should be stopped, but we wait so that
// we can detect if it is not.
setTimeout(function() {
bk(100);
ok(inside(window));
start();
}, 50);
}
});
</script>