Ensure isType methods return false for subclassed values.

Former-commit-id: e300d12eb506c6ae4949bd37cf8eb33c3a4be2e1
This commit is contained in:
John-David Dalton
2013-04-19 00:12:22 -07:00
parent 3bb119f578
commit a707c2fe8e
4 changed files with 58 additions and 50 deletions

View File

@@ -1611,6 +1611,15 @@
equal(typeof func({ 'a': 1 }), expected);
equal(typeof func('a'), expected);
});
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`');
});
});
});
/*--------------------------------------------------------------------------*/