Commit b1b5d0e4 b1b5d0e47bcd0e6061037f9d6083c5546614137b by Nicolas Perriault

added more tests for events

1 parent f7ca4ea2
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;
......