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
1a946795
...
1a946795cb399421851c2c756362e509fbce56e4
authored
2012-12-16 17:05:53 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added tests for popups opened with target=_blank links
1 parent
3bb07c1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
tests/site/popup.html
tests/suites/casper/popup.js
tests/site/popup.html
View file @
1a94679
...
...
@@ -6,6 +6,7 @@
</head>
<a
href=
"."
class=
"close"
>
close
</a>
<body>
<a
href=
"/tests/site/form.html"
target=
"_blank"
>
new window
</a>
<script>
var
w
=
window
.
open
(
"http://localhost:54321/tests/site/index.html"
,
"popup"
,
"menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300"
);
...
...
tests/suites/casper/popup.js
View file @
1a94679
...
...
@@ -65,12 +65,22 @@ casper.thenClick('.close', function() {
this
.
test
.
assertUrlMatches
(
/popup
\.
html$/
,
'Casper.withPopup() has reverted to main page after using the popup'
);
this
.
test
.
assertEquals
(
this
.
popups
.
length
,
0
,
'Popup is removed when closed'
);
this
.
removeAllListeners
(
'popup.created'
);
this
.
removeAllListeners
(
'popup.loaded'
);
this
.
removeAllListeners
(
'popup.closed'
);
});
casper
.
thenClick
(
'a[target="_blank"]'
);
casper
.
waitForPopup
(
'form.html'
,
function
()
{
this
.
test
.
pass
(
'Casper.waitForPopup() waits when clicked on a link with target=_blank'
);
});
casper
.
withPopup
(
'form.html'
,
function
()
{
this
.
test
.
assertTitle
(
'CasperJS test form'
);
});
casper
.
run
(
function
()
{
// removes event listeners as they've now been tested already
this
.
removeAllListeners
(
'popup.created'
);
this
.
removeAllListeners
(
'popup.loaded'
);
this
.
removeAllListeners
(
'popup.closed'
);
this
.
test
.
done
(
23
);
this
.
test
.
done
(
25
);
});
...
...
Please
register
or
sign in
to post a comment