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
0b5aa6b0
...
0b5aa6b03a8ed53371dbee800ec648175b786dc3
authored
2011-10-15 16:45:04 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed Casper#exists(), added Casper.Tester#assertExists() method
1 parent
59984894
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
casper.js
casper.js
View file @
0b5aa6b
...
...
@@ -296,24 +296,14 @@
},
/**
* Exits phantom.
*
* @param Number status Status
* @return Casper
*/
exit
:
function
(
status
)
{
phantom
.
exit
(
status
);
return
this
;
},
/**
* Checks if an element matching the provided CSS3 selector exists in
* current page DOM.
*
* @param String selector A CSS3 selector
* @return Boolean
*/
exists
:
function
(
selector
)
{
return
self
.
evaluate
(
function
()
{
return
this
.
evaluate
(
function
()
{
return
__utils__
.
exists
(
'%selector%'
);
},
{
selector
:
selector
...
...
@@ -321,6 +311,17 @@
},
/**
* Exits phantom.
*
* @param Number status Status
* @return Casper
*/
exit
:
function
(
status
)
{
phantom
.
exit
(
status
);
return
this
;
},
/**
* Fills a form with provided field values.
*
* @param String selector A CSS3 selector to the target form to fill
...
...
@@ -983,6 +984,19 @@
};
/**
* Asserts that an element matching the provided CSS3 selector exists in
* remote DOM.
*
* @param String selector CSS3 selectore
* @param String message Test description
*/
this
.
assertExists
=
function
(
selector
,
message
)
{
var
f
=
casper
.
exists
(
selector
)
console
.
log
(
'plop'
)
return
this
.
assert
(
casper
.
exists
(
selector
),
message
);
};
/**
* Asserts that a provided string matches a provided RegExp pattern.
*
* @param String subject The string to test
...
...
Please
register
or
sign in
to post a comment