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
47b368be
...
47b368be5fab6ac9fe17d5c923384f44ba7d8127
authored
2011-11-09 11:30:34 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added Casper.Tester.assertRaises()
1 parent
a2420455
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletions
casper.js
casper.js
View file @
47b368b
...
...
@@ -113,9 +113,15 @@
* @return Casper
*/
capture
:
function
(
targetFile
,
clipRect
)
{
if
(
typeof
clipRect
!==
"object"
)
{
throw
new
Error
(
"ClipRect must be an object instance."
);
}
var
previousClipRect
=
this
.
page
.
clipRect
;
if
(
clipRect
)
{
this
.
page
.
clipRect
=
clipRect
;
this
.
log
(
'Capturing page to '
+
targetFile
+
' with clipRect'
+
JSON
.
stringify
(
clipRect
),
"debug"
);
}
else
{
this
.
log
(
'Capturing page to '
+
targetFile
,
"debug"
);
}
if
(
!
this
.
page
.
render
(
targetFile
))
{
this
.
log
(
'Failed to capture screenshot as '
+
targetFile
,
"error"
);
...
...
@@ -1262,6 +1268,23 @@
};
/**
* Asserts that the provided function called with the given parameters
* will raise an exception.
*
* @param Function fn The function to test
* @param Array args The arguments to pass to the function
* @param String message Test description
*/
this
.
assertRaises
=
function
(
fn
,
args
,
message
)
{
try
{
fn
.
apply
(
null
,
args
);
this
.
fail
(
message
);
}
catch
(
e
)
{
this
.
pass
(
message
);
}
};
/**
* Asserts that at least an element matching the provided CSS3 selector
* exists in remote DOM.
*
...
...
@@ -1471,7 +1494,8 @@
};
/**
* Provides a better typeof operator equivalent
* Provides a better typeof operator equivalent, able to retrieve the array
* type.
*
* @param mixed input
* @return String
...
...
Please
register
or
sign in
to post a comment