Add _.has tests for deep paths.

This commit is contained in:
jdalton
2015-04-03 17:08:30 -05:00
parent 9749ff7c67
commit 003d6ec43f

View File

@@ -6152,7 +6152,17 @@
strictEqual(_.has(object, 'a'), true);
});
test('should not check for inherited properties', 1, function() {
test('should support deep paths', 1, function() {
var object = { 'a': { 'b': { 'c': 3 } } };
strictEqual(_.has(object, 'a.b.c'), true);
});
test('should check for a key over a path', 1, function() {
var object = { 'a.b.c': 3, 'a': { 'b': {} } };
strictEqual(_.has(object, 'a.b.c'), true);
});
test('should return `false` for inherited properties', 1, function() {
function Foo() {}
Foo.prototype.a = 1;