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
dec4d533
...
dec4d533529512ab408347bd5e4631a6d8996314
authored
2012-12-12 22:34:42 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added tests for Casper.getGlobal()
1 parent
6ce99dd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
tests/site/global.html
tests/suites/casper/global.js
tests/site/global.html
View file @
dec4d53
...
...
@@ -4,6 +4,11 @@
<script
type=
"text/javascript"
>
var
myGlobal
=
'awesome string'
;
var
myUnencodableGlobal
=
document
;
var
myObject
=
{
foo
:
{
bar
:
'baz'
}
};
</script>
</body>
</html>
\ No newline at end of file
</html>
...
...
tests/suites/casper/global.js
View file @
dec4d53
...
...
@@ -2,10 +2,14 @@
/*jshint strict:false*/
casper
.
start
(
'tests/site/global.html'
,
function
()
{
this
.
test
.
comment
(
'Casper.getGlobal()'
);
this
.
test
.
assertEquals
(
this
.
getGlobal
(
'myGlobal'
),
'awesome string'
,
'Casper.getGlobal() can retrieve a remote global variable'
);
this
.
test
.
assertRaises
(
this
.
getGlobal
,
[
'myUnencodableGlobal'
],
'Casper.getGlobal() does not fail trying to encode an unencodable global'
);
this
.
test
.
assertEquals
(
this
.
getGlobal
(
'myGlobal'
),
'awesome string'
,
'Casper.getGlobal() can retrieve a remote global variable'
);
this
.
test
.
assertEquals
(
this
.
getGlobal
(
'myObject'
).
foo
.
bar
,
'baz'
,
'Casper.getGlobal() can retrieves a serializable object'
);
this
.
test
.
assertRaises
(
this
.
getGlobal
,
[
'myUnencodableGlobal'
],
'Casper.getGlobal() does not fail trying to encode an unserializable global'
);
});
casper
.
run
(
function
()
{
this
.
test
.
done
(
2
);
this
.
test
.
done
(
3
);
});
...
...
Please
register
or
sign in
to post a comment