_.result calls property with the correct context.

This commit is contained in:
Brad Dunbar
2012-03-21 06:33:37 -04:00
parent 594f1e2016
commit ebb9db4e8e
2 changed files with 3 additions and 3 deletions

View File

@@ -166,10 +166,10 @@ $(document).ready(function() {
});
test('result calls functions and returns primitives', function() {
var obj = {w: '', x: 'x', y: function(){ return 'y'; }};
var obj = {w: '', x: 'x', y: function(){ return this.x; }};
strictEqual(_.result(obj, 'w'), '');
strictEqual(_.result(obj, 'x'), 'x');
strictEqual(_.result(obj, 'y'), 'y');
strictEqual(_.result(obj, 'y'), 'x');
strictEqual(_.result(obj, 'z'), undefined);
strictEqual(_.result(null, 'x'), null);
});