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
c447f791
...
c447f79116dd477a264110e5c17113ee2cc5654d
authored
2014-05-17 13:15:14 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #919 #916 - native use of phantomjs WebPage#reload()
1 parent
e14544ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
modules/casper.js
tests/site/form.html
tests/suites/casper/reload.js
modules/casper.js
View file @
c447f79
...
...
@@ -1445,9 +1445,8 @@ Casper.prototype.open = function open(location, settings) {
Casper
.
prototype
.
reload
=
function
reload
(
then
)
{
"use strict"
;
this
.
checkStarted
();
// window.location.reload() is broken under phantomjs
this
.
then
(
function
()
{
this
.
open
(
this
.
getCurrentUrl
()
);
this
.
page
.
reload
(
);
});
if
(
utils
.
isFunction
(
then
))
{
this
.
then
(
this
.
createStep
(
then
));
...
...
tests/site/form.html
View file @
c447f79
...
...
@@ -37,6 +37,9 @@
(
function
()
{
'use strict'
;
// Force fields initialization
document
.
querySelector
(
"input[name=email]"
).
value
=
""
;
// El-cheapo autocomplete
var
choices
=
[
...
...
tests/suites/casper/reload.js
0 → 100644
View file @
c447f79
/*global casper*/
/*jshint strict:false, maxstatements: 99*/
casper
.
test
.
begin
(
'reload() tests'
,
3
,
function
(
test
)
{
var
formUrl
=
'tests/site/form.html'
;
casper
.
start
(
formUrl
,
function
()
{
this
.
fill
(
"form"
,
{
email
:
"foo@foo.com"
},
false
);
});
casper
.
once
(
"page.resource.requested"
,
function
(
resource
)
{
test
.
assert
(
resource
.
url
.
indexOf
(
formUrl
)
>
0
);
}).
reload
(
function
()
{
test
.
assertUrlMatches
(
formUrl
);
test
.
assertField
(
"email"
,
""
);
}).
run
(
function
()
{
test
.
done
();
});
});
Please
register
or
sign in
to post a comment