Commit 8fa8d23a 8fa8d23aa0146a63a0ade498dcfca7a47bbc7cc4 by Nicolas Perriault

fixes #327 - event handler for 'page.confirm' always returns true

1 parent 111c00b6
......@@ -1988,8 +1988,10 @@ function createPage(casper) {
}
};
page.onConfirm = function onConfirm(message) {
var listener_exists = typeof casper._filters['page.confirm'] !== 'undefined';
return listener_exists ? casper.filter('page.confirm', message) : true;
if ('page.confirm' in casper._filters) {
return casper.filter('page.confirm', message);
}
return true;
};
page.onConsoleMessage = function onConsoleMessage(msg) {
// client utils casper console message
......
......@@ -13,7 +13,7 @@ casper.start('tests/site/confirm.html', function() {
casper.then(function() {
//remove the page.confirm event filter so we can add a new one
delete casper._filters['page.confirm'];
casper.removeAllFilters('page.confirm')
casper.setFilter('page.confirm', function(message) {
return false;
});
......