added a test for the page.confirm event handler returning false
Showing
1 changed file
with
14 additions
and
2 deletions
... | @@ -8,10 +8,22 @@ casper.setFilter('page.confirm', function(message) { | ... | @@ -8,10 +8,22 @@ casper.setFilter('page.confirm', function(message) { |
8 | }); | 8 | }); |
9 | 9 | ||
10 | casper.start('tests/site/confirm.html', function() { | 10 | casper.start('tests/site/confirm.html', function() { |
11 | this.test.assert(this.getGlobal('confirmed'), 'confirmation received'); | 11 | this.test.assert(this.getGlobal('confirmed'), 'confirmation dialog accepted'); |
12 | }); | ||
13 | |||
14 | casper.then(function() { | ||
15 | //remove the page.confirm event filter so we can add a new one | ||
16 | delete casper._filters['page.confirm']; | ||
17 | casper.setFilter('page.confirm', function(message) { | ||
18 | return false; | ||
19 | }); | ||
20 | }); | ||
21 | |||
22 | casper.thenOpen('/tests/site/confirm.html', function() { | ||
23 | this.test.assertNot(this.getGlobal('confirmed'), 'confirmation dialog canceled'); | ||
12 | }); | 24 | }); |
13 | 25 | ||
14 | casper.run(function() { | 26 | casper.run(function() { |
15 | this.test.assertEquals(received, 'are you sure?', 'confirmation message is ok'); | 27 | this.test.assertEquals(received, 'are you sure?', 'confirmation message is ok'); |
16 | this.test.done(2); | 28 | this.test.done(3); |
17 | }); | 29 | }); | ... | ... |
-
Please register or sign in to post a comment