mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Avoid false test fails in isType unit tests.
Former-commit-id: b7311a8c3844000efab5d56d3632b99f0bf16ce8
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -10,7 +10,8 @@
|
||||
phantom = window.phantom,
|
||||
process = window.process,
|
||||
slice = Array.prototype.slice,
|
||||
system = window.system;
|
||||
system = window.system,
|
||||
toString = Object.prototype.toString;
|
||||
|
||||
/** Use a single "load" function */
|
||||
var load = typeof require == 'function' ? require : window.load;
|
||||
@@ -1626,16 +1627,23 @@
|
||||
equal(typeof func({ 'a': 1 }), expected);
|
||||
equal(typeof func('a'), expected);
|
||||
});
|
||||
});
|
||||
|
||||
(function() {
|
||||
test('should return `false` for subclassed values', function() {
|
||||
_.each(['isArray', 'isBoolean', 'isDate', 'isFunction', 'isNumber', 'isRegExp', 'isString'], function(methodName) {
|
||||
function Foo() {}
|
||||
Foo.prototype = window[methodName.slice(2)].prototype;
|
||||
|
||||
strictEqual(_[methodName](new Foo), false, '_.' + methodName + ' returns `false`');
|
||||
var object = new Foo;
|
||||
if (toString.call(object) == '[object Object]') {
|
||||
strictEqual(_[methodName](object), false, '_.' + methodName + ' returns `false`');
|
||||
} else {
|
||||
skipTest();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user