fixes #327 - event handler for 'page.confirm' always returns true
Showing
2 changed files
with
5 additions
and
3 deletions
... | @@ -1988,8 +1988,10 @@ function createPage(casper) { | ... | @@ -1988,8 +1988,10 @@ function createPage(casper) { |
1988 | } | 1988 | } |
1989 | }; | 1989 | }; |
1990 | page.onConfirm = function onConfirm(message) { | 1990 | page.onConfirm = function onConfirm(message) { |
1991 | var listener_exists = typeof casper._filters['page.confirm'] !== 'undefined'; | 1991 | if ('page.confirm' in casper._filters) { |
1992 | return listener_exists ? casper.filter('page.confirm', message) : true; | 1992 | return casper.filter('page.confirm', message); |
1993 | } | ||
1994 | return true; | ||
1993 | }; | 1995 | }; |
1994 | page.onConsoleMessage = function onConsoleMessage(msg) { | 1996 | page.onConsoleMessage = function onConsoleMessage(msg) { |
1995 | // client utils casper console message | 1997 | // client utils casper console message | ... | ... |
... | @@ -13,7 +13,7 @@ casper.start('tests/site/confirm.html', function() { | ... | @@ -13,7 +13,7 @@ casper.start('tests/site/confirm.html', function() { |
13 | 13 | ||
14 | casper.then(function() { | 14 | casper.then(function() { |
15 | //remove the page.confirm event filter so we can add a new one | 15 | //remove the page.confirm event filter so we can add a new one |
16 | delete casper._filters['page.confirm']; | 16 | casper.removeAllFilters('page.confirm') |
17 | casper.setFilter('page.confirm', function(message) { | 17 | casper.setFilter('page.confirm', function(message) { |
18 | return false; | 18 | return false; |
19 | }); | 19 | }); | ... | ... |
-
Please register or sign in to post a comment