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
6c72cc1d
...
6c72cc1d37cde0624103ae5bc7d93cfe309211c9
authored
2012-12-29 08:55:14 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
migrated casper/confirm tests to new test format
1 parent
b2398148
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
tests/suites/casper/confirm.js
tests/suites/casper/confirm.js
View file @
6c72cc1
/*global casper*/
/*jshint strict:false*/
var
received
;
casper
.
setFilter
(
'page.confirm'
,
function
(
message
)
{
received
=
message
;
return
true
;
});
casper
.
start
(
'tests/site/confirm.html'
,
function
()
{
this
.
test
.
assert
(
this
.
getGlobal
(
'confirmed'
),
'confirmation dialog accepted'
);
casper
.
test
.
begin
(
'can confirm dialog'
,
2
,
function
(
test
)
{
var
received
;
casper
.
removeAllFilters
(
'page.confirm'
)
casper
.
setFilter
(
'page.confirm'
,
function
(
message
)
{
received
=
message
;
return
true
;
});
casper
.
start
(
'tests/site/confirm.html'
,
function
()
{
test
.
assert
(
this
.
getGlobal
(
'confirmed'
),
'confirmation dialog accepted'
);
});
casper
.
run
(
function
()
{
test
.
assertEquals
(
received
,
'are you sure?'
,
'confirmation message is ok'
);
test
.
done
();
});
});
casper
.
then
(
function
()
{
//remove the page.confirm event filter so we can add a new one
casper
.
test
.
begin
(
'can cancel dialog'
,
1
,
function
(
test
)
{
casper
.
removeAllFilters
(
'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
(
3
);
casper
.
start
(
'tests/site/confirm.html'
,
function
()
{
test
.
assertNot
(
this
.
getGlobal
(
'confirmed'
),
'confirmation dialog canceled'
);
});
casper
.
run
(
function
()
{
test
.
done
();
});
});
...
...
Please
register
or
sign in
to post a comment