forked from PencilCode/jquery-turtle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear.html
More file actions
37 lines (37 loc) · 959 Bytes
/
clear.html
File metadata and controls
37 lines (37 loc) · 959 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
32
33
34
35
36
37
<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("Clear test.");
asyncTest("Runs cs, cg, and ct, and verifies what is cleared.", function() {
$('#qunit').addClass('turtlefield');
speed(Infinity);
write('hello');
var b = new Turtle();
b.fd(100);
dot(purple, 100);
ok(touches(purple));
equal(b.parent().length, 1);
cg();
ok(!touches(purple));
equal(b.parent().length, 1);
equal($('div').last().text(), "hello");
dot(purple, 100);
ok(touches(purple));
ct();
ok($('div').text() != "hello");
ok(touches(purple));
equal(b.parent().length, 1);
write('hello again');
equal($('div').last().text(), "hello again");
cs();
ok($('div').last().text() != "hello again");
ok(!touches(purple));
equal(b.parent().length, 0);
start();
});
</script>