forked from PencilCode/jquery-turtle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove.html
More file actions
43 lines (43 loc) · 1.17 KB
/
remove.html
File metadata and controls
43 lines (43 loc) · 1.17 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
<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("Remove test.");
asyncTest("Makes and removes turtles.", function() {
speed(10);
var a = new Turtle();
var b = new Turtle();
var reached1 = false;
a.pen(red);
a.fd(100);
b.pen(blue);
b.bk(100);
remove(a, b);
// verify that a and b are not removed right away.
equal(a.parent().length, 1);
equal(b.parent().length, 1);
done(function() {
// verify that a and b are both removed.
equal(a.parent().length, 0);
equal(b.parent().length, 0);
// verify that drawing happened.
ok(touches('red'));
ok(touches('blue'));
var t = turtle, completed = false;
// Now remove the main turtle.
remove(turtle, function() { completed = true; });
ok(completed);
equal(t.parent().length, 0);
equal(typeof(window.turtle), 'undefined');
// Restore globals to an initial state.
$.turtle({ids: false});
window.turtle = $('#turtle');
equal(typeof(window.turtle), 'object');
start();
});
});
</script>