Commit aea6e574 aea6e574cc1e4cfebe8c9c4376e8af7c1b7bb6a7 by Nicolas Perriault

updated use of utils.is* helpers

1 parent 35c49f93
...@@ -40,7 +40,7 @@ exports.create = function(fn) { ...@@ -40,7 +40,7 @@ exports.create = function(fn) {
40 * FIXME: use new Function() instead of eval() 40 * FIXME: use new Function() instead of eval()
41 */ 41 */
42 var FunctionArgsInjector = function(fn) { 42 var FunctionArgsInjector = function(fn) {
43 if (!utils.isType(fn, "function")) { 43 if (!utils.isFunction(fn)) {
44 throw new Error("FunctionArgsInjector() can only process functions"); 44 throw new Error("FunctionArgsInjector() can only process functions");
45 } 45 }
46 this.fn = fn; 46 this.fn = fn;
...@@ -63,7 +63,7 @@ var FunctionArgsInjector = function(fn) { ...@@ -63,7 +63,7 @@ var FunctionArgsInjector = function(fn) {
63 63
64 this.process = function(values) { 64 this.process = function(values) {
65 var fnObj = this.extract(this.fn); 65 var fnObj = this.extract(this.fn);
66 if (!utils.isType(fnObj, "object")) { 66 if (!utils.isObject(fnObj)) {
67 throw new Error("Unable to process function " + this.fn.toString()); 67 throw new Error("Unable to process function " + this.fn.toString());
68 } 68 }
69 var inject = this.getArgsInjectionString(fnObj.args, values); 69 var inject = this.getArgsInjectionString(fnObj.args, values);
......
...@@ -43,7 +43,7 @@ exports.create = function(casper, options) { ...@@ -43,7 +43,7 @@ exports.create = function(casper, options) {
43 var Tester = function(casper, options) { 43 var Tester = function(casper, options) {
44 this.running = false; 44 this.running = false;
45 this.suites = []; 45 this.suites = [];
46 this.options = utils.isType(options, "object") ? options : {}; 46 this.options = utils.isObject(options) ? options : {};
47 47
48 if (!utils.isCasperObject(casper)) { 48 if (!utils.isCasperObject(casper)) {
49 throw new Error("Tester needs a Casper instance"); 49 throw new Error("Tester needs a Casper instance");
...@@ -370,7 +370,7 @@ var Tester = function(casper, options) { ...@@ -370,7 +370,7 @@ var Tester = function(casper, options) {
370 * @param Boolean exit 370 * @param Boolean exit
371 */ 371 */
372 this.renderResults = function(exit, status, save) { 372 this.renderResults = function(exit, status, save) {
373 save = utils.isType(save, "string") ? save : this.options.save; 373 save = utils.isString(save) ? save : this.options.save;
374 var total = this.testResults.passed + this.testResults.failed, statusText, style, result; 374 var total = this.testResults.passed + this.testResults.failed, statusText, style, result;
375 if (total === 0) { 375 if (total === 0) {
376 statusText = FAIL; 376 statusText = FAIL;
...@@ -387,7 +387,7 @@ var Tester = function(casper, options) { ...@@ -387,7 +387,7 @@ var Tester = function(casper, options) {
387 result = statusText + ' ' + total + ' tests executed, ' + this.testResults.passed + ' passed, ' + this.testResults.failed + ' failed.'; 387 result = statusText + ' ' + total + ' tests executed, ' + this.testResults.passed + ' passed, ' + this.testResults.failed + ' failed.';
388 } 388 }
389 casper.echo(this.colorize(utils.fillBlanks(result), style)); 389 casper.echo(this.colorize(utils.fillBlanks(result), style));
390 if (save && utils.isType(require, "function")) { 390 if (save && utils.isFunction(require)) {
391 try { 391 try {
392 fs.write(save, exporter.getXML(), 'w'); 392 fs.write(save, exporter.getXML(), 'w');
393 casper.echo('result log stored in ' + save, 'INFO'); 393 casper.echo('result log stored in ' + save, 'INFO');
...@@ -466,7 +466,7 @@ var Tester = function(casper, options) { ...@@ -466,7 +466,7 @@ var Tester = function(casper, options) {
466 if (utils.betterTypeOf(v1) !== utils.betterTypeOf(v2)) { 466 if (utils.betterTypeOf(v1) !== utils.betterTypeOf(v2)) {
467 return false; 467 return false;
468 } 468 }
469 if (utils.isType(v1, "function")) { 469 if (utils.isFunction(v1)) {
470 return v1.toString() === v2.toString(); 470 return v1.toString() === v2.toString();
471 } 471 }
472 if (v1 instanceof Object && v2 instanceof Object) { 472 if (v1 instanceof Object && v2 instanceof Object) {
......
...@@ -332,7 +332,7 @@ exports.node = node; ...@@ -332,7 +332,7 @@ exports.node = node;
332 * @return String 332 * @return String
333 */ 333 */
334 function serialize(value) { 334 function serialize(value) {
335 if (isType(value, "array")) { 335 if (isArray(value)) {
336 value = value.map(function(prop) { 336 value = value.map(function(prop) {
337 return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop; 337 return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop;
338 }); 338 });
......