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
789f60d0
...
789f60d04e1090c3e5ed2ee3943528b9fb3bc8e5
authored
2012-06-05 11:12:02 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added colors to default test messages
1 parent
123f3128
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
modules/tester.js
modules/tester.js
View file @
789f60d
...
...
@@ -229,7 +229,7 @@ var Tester = function Tester(casper, options) {
this
.
assertExists
=
this
.
assertExist
=
this
.
assertSelectorExists
=
this
.
assertSelectorExist
=
function
assertExists
(
selector
,
message
)
{
return
this
.
assert
(
casper
.
exists
(
selector
),
message
,
{
type
:
"assertExists"
,
standard
:
f
(
"Found an element matching %s"
,
selector
),
standard
:
f
(
"Found an element matching %s"
,
this
.
colorize
(
selector
,
'COMMENT'
)
),
values
:
{
selector
:
selector
}
...
...
@@ -247,7 +247,7 @@ var Tester = function Tester(casper, options) {
this
.
assertDoesntExist
=
this
.
assertNotExists
=
function
assertDoesntExist
(
selector
,
message
)
{
return
this
.
assert
(
!
casper
.
exists
(
selector
),
message
,
{
type
:
"assertDoesntExist"
,
standard
:
f
(
"No element matching selector %s is found"
,
selector
),
standard
:
f
(
"No element matching selector %s is found"
,
this
.
colorize
(
selector
,
'COMMENT'
)
),
values
:
{
selector
:
selector
}
...
...
@@ -265,7 +265,7 @@ var Tester = function Tester(casper, options) {
var
currentHTTPStatus
=
casper
.
currentHTTPStatus
;
return
this
.
assert
(
this
.
testEquals
(
casper
.
currentHTTPStatus
,
status
),
message
,
{
type
:
"assertHttpStatus"
,
standard
:
f
(
"HTTP status code is %s"
,
status
),
standard
:
f
(
"HTTP status code is %s"
,
this
.
colorize
(
status
,
'COMMENT'
)
),
values
:
{
current
:
currentHTTPStatus
,
expected
:
status
...
...
@@ -383,7 +383,7 @@ var Tester = function Tester(casper, options) {
var
currentTitle
=
casper
.
getTitle
();
return
this
.
assert
(
this
.
testEquals
(
currentTitle
,
expected
),
message
,
{
type
:
"assertTitle"
,
standard
:
f
(
'Page title is "%s"'
,
expected
),
standard
:
f
(
'Page title is "%s"'
,
this
.
colorize
(
expected
,
'COMMENT'
)
),
values
:
{
subject
:
currentTitle
,
expected
:
expected
...
...
@@ -403,7 +403,7 @@ var Tester = function Tester(casper, options) {
var
actual
=
utils
.
betterTypeOf
(
subject
);
return
this
.
assert
(
this
.
testEquals
(
actual
,
type
),
message
,
{
type
:
"assertType"
,
standard
:
f
(
'Subject type is "%s"'
,
t
ype
),
standard
:
f
(
'Subject type is "%s"'
,
t
his
.
colorize
(
type
,
'COMMENT'
)
),
values
:
{
subject
:
subject
,
type
:
type
,
...
...
@@ -445,7 +445,7 @@ var Tester = function Tester(casper, options) {
* Casper.Colorizer#colorize()
*/
this
.
colorize
=
function
colorize
(
message
,
style
)
{
return
casper
.
colorizer
.
colorize
(
message
,
style
);
return
casper
.
getColorizer
()
.
colorize
(
message
,
style
);
};
/**
...
...
@@ -535,7 +535,7 @@ var Tester = function Tester(casper, options) {
* @param String style
*/
this
.
formatMessage
=
function
formatMessage
(
message
,
style
)
{
var
parts
=
/
([
a-z0-9_
\.]
+
\(\))(
.*
)
/i
.
exec
(
message
);
var
parts
=
/
^
([
a-z0-9_
\.]
+
\(\))(
.*
)
/i
.
exec
(
message
);
if
(
!
parts
)
{
return
message
;
}
...
...
Please
register
or
sign in
to post a comment