added more tests for events
Showing
1 changed file
with
20 additions
and
0 deletions
1 | // events | ||
2 | |||
3 | casper.test.comment("events"); | ||
4 | |||
5 | casper.plopped = false; | ||
6 | |||
7 | casper.on("plop", function() { | ||
8 | this.plopped = true; | ||
9 | }); | ||
10 | |||
11 | casper.test.assert(Object.keys(casper._events).some(function(i) { | ||
12 | return i === "plop"; | ||
13 | }), "on() has set an event handler"); | ||
14 | |||
15 | casper.emit("plop"); | ||
16 | |||
17 | casper.test.assert(casper.plopped, "emit() emits an event"); | ||
18 | |||
1 | // filters | 19 | // filters |
2 | 20 | ||
21 | casper.test.comment("filters"); | ||
22 | |||
3 | casper.foo = 0; | 23 | casper.foo = 0; |
4 | casper.setFilter("test", function(a) { | 24 | casper.setFilter("test", function(a) { |
5 | this.foo = 42; | 25 | this.foo = 42; | ... | ... |
-
Please register or sign in to post a comment