Commit 55103a57 55103a57e0560d4687d049ec38701be1f02e6d41 by Nicolas Perriault

fixes #148 - broken utils.isWebPage()

1 parent 0245dcfb
......@@ -5,7 +5,8 @@ XXXX-XX-XX, v0.6.11
-------------------
- closed [#132](https://github.com/n1k0/casperjs/issues/132) - added ability to include js/coffee files using a dedicated option when using the `casper test` command
- fixes [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls
- fixed [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls
- fixed [#148](https://github.com/n1k0/casperjs/issues/148) - `utils.isWebPage()` was broken
- closed [#144](https://github.com/n1k0/casperjs/issues/144) - added a `safeLogs` option to blur password values in debug logs. **This option is set to `true` by default.**
- added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string
- added `Tester.assertTitleMatch()` method
......
Subproject commit ed91017f48fd77e8c3a268ecdbb78adac7bce0b5
Subproject commit 76cc32f262a3ef924a67f33bb17432e3a5c33e03
......
......@@ -400,6 +400,8 @@ Casper.prototype.die = function die(message, status) {
*
* @param String url The url of the resource to download
* @param String targetPath The destination file path
* @param String method The HTTP method to use (default: GET)
* @param String data Optional data to pass performing the request
* @return Casper
*/
Casper.prototype.download = function download(url, targetPath, method, data) {
......
......@@ -100,7 +100,7 @@ var Tester = function Tester(casper, options) {
if (failure.details) {
this.comment(' details: ' + failure.details);
}
if (failure.values && Object.keys(failure.values).length > 0) {
if (utils.isObject(failure.values) && Object.keys(failure.values).length > 0) {
for (var name in failure.values) {
this.comment(' ' + name + ': ' + utils.serialize(failure.values[name]));
}
......
......@@ -29,6 +29,13 @@ t.comment('fillBlanks()');
}
})();
t.comment('isArray()');
(function() {
t.assertEquals(utils.isArray([]), true, 'isArray() checks for an Array');
t.assertEquals(utils.isArray({}), false, 'isArray() checks for an Array');
t.assertEquals(utils.isArray("foo"), false, 'isArray() checks for an Array');
})();
t.comment('isClipRect()');
(function() {
testCases = [
......@@ -44,6 +51,26 @@ t.comment('isClipRect()');
});
})();
t.comment('isObject()');
(function() {
t.assertEquals(utils.isObject({}), true, 'isObject() checks for an Object');
t.assertEquals(utils.isObject([]), true, 'isObject() checks for an Object');
t.assertEquals(utils.isObject(1), false, 'isObject() checks for an Object');
t.assertEquals(utils.isObject("1"), false, 'isObject() checks for an Object');
t.assertEquals(utils.isObject(function(){}), false, 'isObject() checks for an Object');
t.assertEquals(utils.isObject(new Function('return {};')()), true, 'isObject() checks for an Object');
t.assertEquals(utils.isObject(require('webpage').create()), true, 'isObject() checks for an Object');
t.assertEquals(utils.isObject(null), false, 'isObject() checks for an Object');
})();
t.comment('isWebPage()');
(function() {
var pageModule = require('webpage');
t.assertEquals(utils.isWebPage(pageModule), false, 'isWebPage() checks for a WebPage instance');
t.assertEquals(utils.isWebPage(pageModule.create()), true, 'isWebPage() checks for a WebPage instance');
t.assertEquals(utils.isWebPage(null), false, 'isWebPage() checks for a WebPage instance');
})();
t.comment('isJsFile()');
(function() {
testCases = {
......