Commit 55103a57 55103a57e0560d4687d049ec38701be1f02e6d41 by Nicolas Perriault

fixes #148 - broken utils.isWebPage()

1 parent 0245dcfb
...@@ -5,7 +5,8 @@ XXXX-XX-XX, v0.6.11 ...@@ -5,7 +5,8 @@ XXXX-XX-XX, v0.6.11
5 ------------------- 5 -------------------
6 6
7 - 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 7 - 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
8 - fixes [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls 8 - fixed [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls
9 - fixed [#148](https://github.com/n1k0/casperjs/issues/148) - `utils.isWebPage()` was broken
9 - 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.** 10 - 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.**
10 - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string 11 - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string
11 - added `Tester.assertTitleMatch()` method 12 - added `Tester.assertTitleMatch()` method
......
1 Subproject commit ed91017f48fd77e8c3a268ecdbb78adac7bce0b5 1 Subproject commit 76cc32f262a3ef924a67f33bb17432e3a5c33e03
......
...@@ -400,6 +400,8 @@ Casper.prototype.die = function die(message, status) { ...@@ -400,6 +400,8 @@ Casper.prototype.die = function die(message, status) {
400 * 400 *
401 * @param String url The url of the resource to download 401 * @param String url The url of the resource to download
402 * @param String targetPath The destination file path 402 * @param String targetPath The destination file path
403 * @param String method The HTTP method to use (default: GET)
404 * @param String data Optional data to pass performing the request
403 * @return Casper 405 * @return Casper
404 */ 406 */
405 Casper.prototype.download = function download(url, targetPath, method, data) { 407 Casper.prototype.download = function download(url, targetPath, method, data) {
......
...@@ -100,7 +100,7 @@ var Tester = function Tester(casper, options) { ...@@ -100,7 +100,7 @@ var Tester = function Tester(casper, options) {
100 if (failure.details) { 100 if (failure.details) {
101 this.comment(' details: ' + failure.details); 101 this.comment(' details: ' + failure.details);
102 } 102 }
103 if (failure.values && Object.keys(failure.values).length > 0) { 103 if (utils.isObject(failure.values) && Object.keys(failure.values).length > 0) {
104 for (var name in failure.values) { 104 for (var name in failure.values) {
105 this.comment(' ' + name + ': ' + utils.serialize(failure.values[name])); 105 this.comment(' ' + name + ': ' + utils.serialize(failure.values[name]));
106 } 106 }
......
...@@ -29,6 +29,13 @@ t.comment('fillBlanks()'); ...@@ -29,6 +29,13 @@ t.comment('fillBlanks()');
29 } 29 }
30 })(); 30 })();
31 31
32 t.comment('isArray()');
33 (function() {
34 t.assertEquals(utils.isArray([]), true, 'isArray() checks for an Array');
35 t.assertEquals(utils.isArray({}), false, 'isArray() checks for an Array');
36 t.assertEquals(utils.isArray("foo"), false, 'isArray() checks for an Array');
37 })();
38
32 t.comment('isClipRect()'); 39 t.comment('isClipRect()');
33 (function() { 40 (function() {
34 testCases = [ 41 testCases = [
...@@ -44,6 +51,26 @@ t.comment('isClipRect()'); ...@@ -44,6 +51,26 @@ t.comment('isClipRect()');
44 }); 51 });
45 })(); 52 })();
46 53
54 t.comment('isObject()');
55 (function() {
56 t.assertEquals(utils.isObject({}), true, 'isObject() checks for an Object');
57 t.assertEquals(utils.isObject([]), true, 'isObject() checks for an Object');
58 t.assertEquals(utils.isObject(1), false, 'isObject() checks for an Object');
59 t.assertEquals(utils.isObject("1"), false, 'isObject() checks for an Object');
60 t.assertEquals(utils.isObject(function(){}), false, 'isObject() checks for an Object');
61 t.assertEquals(utils.isObject(new Function('return {};')()), true, 'isObject() checks for an Object');
62 t.assertEquals(utils.isObject(require('webpage').create()), true, 'isObject() checks for an Object');
63 t.assertEquals(utils.isObject(null), false, 'isObject() checks for an Object');
64 })();
65
66 t.comment('isWebPage()');
67 (function() {
68 var pageModule = require('webpage');
69 t.assertEquals(utils.isWebPage(pageModule), false, 'isWebPage() checks for a WebPage instance');
70 t.assertEquals(utils.isWebPage(pageModule.create()), true, 'isWebPage() checks for a WebPage instance');
71 t.assertEquals(utils.isWebPage(null), false, 'isWebPage() checks for a WebPage instance');
72 })();
73
47 t.comment('isJsFile()'); 74 t.comment('isJsFile()');
48 (function() { 75 (function() {
49 testCases = { 76 testCases = {
......