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
c8764da9
...
c8764da9946cc6fc3b88057e256380a3f432eb0f
authored
2013-09-09 01:35:50 +0200
by
Mickaël Andrieu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #602 Pass all travis tests
1 parent
33271089
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
modules/tester.js
tests/suites/tester/assert.js
modules/tester.js
View file @
c8764da
...
...
@@ -849,15 +849,15 @@ Tester.prototype.assertType = function assertType(subject, type, message) {
*/
Tester
.
prototype
.
assertInstanceOf
=
function
assertInstanceOf
(
subject
,
className
,
message
)
{
"use strict"
;
if
(
utils
.
betterTypeOf
(
constructor
)
!==
"function"
)
{
if
(
utils
.
betterTypeOf
(
subject
.
constructor
)
!==
"function"
)
{
throw
new
CasperError
(
'Subject is null or undefined.'
);
}
return
this
.
assert
(
utils
.
equals
(
subject
.
constructor
.
name
,
className
),
message
,
{
type
:
"assertInstanceOf"
,
standard
:
f
(
'Subject is an instance of: "%s"'
,
constructor
.
name
),
standard
:
f
(
'Subject is an instance of: "%s"'
,
subject
.
constructor
.
name
),
values
:
{
subject
:
subject
,
c
onstructor
:
constructor
.
n
ame
,
c
lassName
:
classN
ame
,
}
});
};
...
...
tests/suites/tester/assert.js
View file @
c8764da
...
...
@@ -2,7 +2,7 @@
/*jshint strict:false, maxstatements:99*/
var
fs
=
require
(
'fs'
);
casper
.
test
.
begin
(
'Common assertions tests'
,
50
,
function
(
test
)
{
casper
.
test
.
begin
(
'Common assertions tests'
,
49
,
function
(
test
)
{
casper
.
start
(
'tests/site/index.html'
,
function
()
{
test
.
assertTextExists
(
'form'
,
'Tester.assertTextExists() checks that page body contains text'
);
test
.
assertTextExist
(
'form'
,
'Tester.assertTextExist() checks that page body contains text [alias]'
);
...
...
@@ -60,15 +60,13 @@ casper.test.begin('Common assertions tests', 50, function(test) {
test
.
assertTitleMatch
(
/test index/
,
'Tester.assertTitleMatch() works as expected'
);
test
.
assertTitleMatches
(
/test index/
,
'Tester.assertTitleMatches() works as expected [alias]'
);
test
.
assertType
(
"plop"
,
"string"
,
"Tester.assertType() works as expected"
);
// We need two objects to test inheritance case
function
Cow
(){};
function
SuperCow
(){};
SuperCow
.
prototype
=
new
Cow
;
var
daisy
=
new
Cow
();
var
superCowie
=
new
SuperCow
();
// we need a class and an instance of this class
function
Cow
(){}
var
daisy
=
new
Cow
();
test
.
assertInstanceOf
(
12
,
"Number"
,
"Tester.assertInstanceOf() works as expected"
);
test
.
assertInstanceOf
(
"Boo"
,
"String"
,
"Tester.assertInstanceOf() works as expected"
);
test
.
assertInstanceOf
([
"moo"
,
"bar"
],
"Array"
,
"Tester.assertInstanceOf() works as expected"
)
test
.
assertInstanceOf
(
true
,
"Boolean"
,
"Test.assertInstanceOf() works as expected"
);
test
.
assertInstanceOf
(
daisy
,
"Cow"
,
"Tester.assertInstanceOf() works as expected"
);
test
.
assertInstanceOf
(
superCowie
,
"SuperCow"
,
"Tester.assertInstanceOf() works as expected"
);
test
.
assertUrlMatch
(
/index
\.
html$/
,
"Tester.assertUrlMatch() works as expected"
);
test
.
assertUrlMatches
(
/index
\.
html$/
,
"Tester.assertUrlMatches() works as expected [alias]"
);
test
.
assertVisible
(
'img'
,
'Tester.assertVisible() works as expected'
);
...
...
Please
register
or
sign in
to post a comment