Commit 584ab551 584ab551958cc2bbe549faf1bdcdd98da9c35678 by Mathieu Pillard

refs #1032 - Don't use a regexp search for string search in resourceExists

1 parent ae424f2e
...@@ -1488,7 +1488,7 @@ Casper.prototype.resourceExists = function resourceExists(test) { ...@@ -1488,7 +1488,7 @@ Casper.prototype.resourceExists = function resourceExists(test) {
1488 switch (utils.betterTypeOf(test)) { 1488 switch (utils.betterTypeOf(test)) {
1489 case "string": 1489 case "string":
1490 testFn = function _testResourceExists_String(res) { 1490 testFn = function _testResourceExists_String(res) {
1491 return res.url.search(test) !== -1 && res.status !== 404; 1491 return res.url.indexOf(test) !== -1 && res.status !== 404;
1492 }; 1492 };
1493 break; 1493 break;
1494 case "regexp": 1494 case "regexp":
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 <script id="loader"></script> 8 <script id="loader"></script>
9 <script> 9 <script>
10 setTimeout(function () { 10 setTimeout(function () {
11 document.querySelector("#loader").setAttribute("src", "dummy.js"); 11 document.querySelector("#loader").setAttribute("src", "dummy.js?querystring");
12 }, 1000); 12 }, 1000);
13 </script> 13 </script>
14 </body> 14 </body>
......
...@@ -11,7 +11,7 @@ casper.test.begin("Basic resources tests", 5, function(test) { ...@@ -11,7 +11,7 @@ casper.test.begin("Basic resources tests", 5, function(test) {
11 test.assertResourceExists(function(res) { 11 test.assertResourceExists(function(res) {
12 return res.url.match("dummy.js"); 12 return res.url.match("dummy.js");
13 }, "phantom image found via test Function"); 13 }, "phantom image found via test Function");
14 test.assertResourceExists("dummy.js", "phantom image found via test String"); 14 test.assertResourceExists("dummy.js?querystring", "phantom image found via test String");
15 }, function onTimeout() { 15 }, function onTimeout() {
16 test.fail("waitForResource timeout occured"); 16 test.fail("waitForResource timeout occured");
17 }); 17 });
......