Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
51ded333
...
51ded333c2358bca29795340fa60a614c88243e1
authored
2012-12-21 20:21:29 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'tylerritchie/iss327' into pr-328
2 parents
c881a1a1
d7a36e9e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
modules/casper.js
tests/suites/casper/confirm.js
modules/casper.js
View file @
51ded33
...
...
@@ -1988,7 +1988,8 @@ function createPage(casper) {
}
};
page
.
onConfirm
=
function
onConfirm
(
message
)
{
return
casper
.
filter
(
'page.confirm'
,
message
)
||
true
;
var
listener_exists
=
typeof
casper
.
_filters
[
'page.confirm'
]
!==
'undefined'
;
return
listener_exists
?
casper
.
filter
(
'page.confirm'
,
message
)
:
true
;
};
page
.
onConsoleMessage
=
function
onConsoleMessage
(
msg
)
{
// client utils casper console message
...
...
tests/suites/casper/confirm.js
View file @
51ded33
...
...
@@ -8,10 +8,22 @@ casper.setFilter('page.confirm', function(message) {
});
casper
.
start
(
'tests/site/confirm.html'
,
function
()
{
this
.
test
.
assert
(
this
.
getGlobal
(
'confirmed'
),
'confirmation received'
);
this
.
test
.
assert
(
this
.
getGlobal
(
'confirmed'
),
'confirmation dialog accepted'
);
});
casper
.
then
(
function
()
{
//remove the page.confirm event filter so we can add a new one
delete
casper
.
_filters
[
'page.confirm'
];
casper
.
setFilter
(
'page.confirm'
,
function
(
message
)
{
return
false
;
});
});
casper
.
thenOpen
(
'/tests/site/confirm.html'
,
function
()
{
this
.
test
.
assertNot
(
this
.
getGlobal
(
'confirmed'
),
'confirmation dialog canceled'
);
});
casper
.
run
(
function
()
{
this
.
test
.
assertEquals
(
received
,
'are you sure?'
,
'confirmation message is ok'
);
this
.
test
.
done
(
2
);
this
.
test
.
done
(
3
);
});
...
...
Please
register
or
sign in
to post a comment