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
584ab551
...
584ab551958cc2bbe549faf1bdcdd98da9c35678
authored
2014-09-09 15:44:30 +0200
by
Mathieu Pillard
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #1032 - Don't use a regexp search for string search in resourceExists
1 parent
ae424f2e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
modules/casper.js
tests/site/resources.html
tests/suites/casper/resources.js
modules/casper.js
View file @
584ab55
...
...
@@ -1488,7 +1488,7 @@ Casper.prototype.resourceExists = function resourceExists(test) {
switch
(
utils
.
betterTypeOf
(
test
))
{
case
"string"
:
testFn
=
function
_testResourceExists_String
(
res
)
{
return
res
.
url
.
search
(
test
)
!==
-
1
&&
res
.
status
!==
404
;
return
res
.
url
.
indexOf
(
test
)
!==
-
1
&&
res
.
status
!==
404
;
};
break
;
case
"regexp"
:
...
...
tests/site/resources.html
View file @
584ab55
...
...
@@ -8,7 +8,7 @@
<script
id=
"loader"
></script>
<script>
setTimeout
(
function
()
{
document
.
querySelector
(
"#loader"
).
setAttribute
(
"src"
,
"dummy.js"
);
document
.
querySelector
(
"#loader"
).
setAttribute
(
"src"
,
"dummy.js
?querystring
"
);
},
1000
);
</script>
</body>
...
...
tests/suites/casper/resources.js
View file @
584ab55
...
...
@@ -11,7 +11,7 @@ casper.test.begin("Basic resources tests", 5, function(test) {
test
.
assertResourceExists
(
function
(
res
)
{
return
res
.
url
.
match
(
"dummy.js"
);
},
"phantom image found via test Function"
);
test
.
assertResourceExists
(
"dummy.js"
,
"phantom image found via test String"
);
test
.
assertResourceExists
(
"dummy.js
?querystring
"
,
"phantom image found via test String"
);
},
function
onTimeout
()
{
test
.
fail
(
"waitForResource timeout occured"
);
});
...
...
Please
register
or
sign in
to post a comment