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
aea6e574
...
aea6e574cc1e4cfebe8c9c4376e8af7c1b7bb6a7
authored
2012-01-05 00:36:00 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updated use of utils.is* helpers
1 parent
35c49f93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
modules/injector.js
modules/tester.js
modules/utils.js
modules/injector.js
View file @
aea6e57
...
...
@@ -40,7 +40,7 @@ exports.create = function(fn) {
* FIXME: use new Function() instead of eval()
*/
var
FunctionArgsInjector
=
function
(
fn
)
{
if
(
!
utils
.
is
Type
(
fn
,
"function"
))
{
if
(
!
utils
.
is
Function
(
fn
))
{
throw
new
Error
(
"FunctionArgsInjector() can only process functions"
);
}
this
.
fn
=
fn
;
...
...
@@ -63,7 +63,7 @@ var FunctionArgsInjector = function(fn) {
this
.
process
=
function
(
values
)
{
var
fnObj
=
this
.
extract
(
this
.
fn
);
if
(
!
utils
.
is
Type
(
fnObj
,
"object"
))
{
if
(
!
utils
.
is
Object
(
fnObj
))
{
throw
new
Error
(
"Unable to process function "
+
this
.
fn
.
toString
());
}
var
inject
=
this
.
getArgsInjectionString
(
fnObj
.
args
,
values
);
...
...
modules/tester.js
View file @
aea6e57
...
...
@@ -43,7 +43,7 @@ exports.create = function(casper, options) {
var
Tester
=
function
(
casper
,
options
)
{
this
.
running
=
false
;
this
.
suites
=
[];
this
.
options
=
utils
.
is
Type
(
options
,
"object"
)
?
options
:
{};
this
.
options
=
utils
.
is
Object
(
options
)
?
options
:
{};
if
(
!
utils
.
isCasperObject
(
casper
))
{
throw
new
Error
(
"Tester needs a Casper instance"
);
...
...
@@ -370,7 +370,7 @@ var Tester = function(casper, options) {
* @param Boolean exit
*/
this
.
renderResults
=
function
(
exit
,
status
,
save
)
{
save
=
utils
.
is
Type
(
save
,
"string"
)
?
save
:
this
.
options
.
save
;
save
=
utils
.
is
String
(
save
)
?
save
:
this
.
options
.
save
;
var
total
=
this
.
testResults
.
passed
+
this
.
testResults
.
failed
,
statusText
,
style
,
result
;
if
(
total
===
0
)
{
statusText
=
FAIL
;
...
...
@@ -387,7 +387,7 @@ var Tester = function(casper, options) {
result
=
statusText
+
' '
+
total
+
' tests executed, '
+
this
.
testResults
.
passed
+
' passed, '
+
this
.
testResults
.
failed
+
' failed.'
;
}
casper
.
echo
(
this
.
colorize
(
utils
.
fillBlanks
(
result
),
style
));
if
(
save
&&
utils
.
is
Type
(
require
,
"function"
))
{
if
(
save
&&
utils
.
is
Function
(
require
))
{
try
{
fs
.
write
(
save
,
exporter
.
getXML
(),
'w'
);
casper
.
echo
(
'result log stored in '
+
save
,
'INFO'
);
...
...
@@ -466,7 +466,7 @@ var Tester = function(casper, options) {
if
(
utils
.
betterTypeOf
(
v1
)
!==
utils
.
betterTypeOf
(
v2
))
{
return
false
;
}
if
(
utils
.
is
Type
(
v1
,
"function"
))
{
if
(
utils
.
is
Function
(
v1
))
{
return
v1
.
toString
()
===
v2
.
toString
();
}
if
(
v1
instanceof
Object
&&
v2
instanceof
Object
)
{
...
...
modules/utils.js
View file @
aea6e57
...
...
@@ -332,7 +332,7 @@ exports.node = node;
* @return String
*/
function
serialize
(
value
)
{
if
(
is
Type
(
value
,
"array"
))
{
if
(
is
Array
(
value
))
{
value
=
value
.
map
(
function
(
prop
)
{
return
isFunction
(
prop
)
?
prop
.
toString
().
replace
(
/
\s{2,}
/
,
''
)
:
prop
;
});
...
...
Please
register
or
sign in
to post a comment