Add an _.invoke test for deep paths.

This commit is contained in:
jdalton
2015-04-11 22:14:00 -07:00
parent 715f03f5f1
commit 23354d413f

View File

@@ -6883,6 +6883,14 @@
deepEqual(actual, expected);
});
test('should invoke deep property methods with the correct `this` binding', 2, function() {
var object = { 'a': { 'b': function() { this.c; }, 'c': 1 } };
_.each(['a.b', ['a', 'b']], function(path) {
deepEqual(_.invoke([object], path), [1]);
});
});
}());
/*--------------------------------------------------------------------------*/