Skip to content

Commit

Permalink
Add Symbol tests for _.result
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone committed Oct 8, 2016
1 parent 3a49c72 commit 623587a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,18 @@
assert.strictEqual(_.result(obj, ['b', 'c']), childObj, 'uses the parent as context when accessing deep methods');

assert.strictEqual(_.result({}, [], 'a'), 'a', 'returns the default when prop is empty');

if (typeof Symbol !== 'undefined') {
var x = Symbol('x');
var symbolObject = {};
symbolObject[x] = 'foo';
assert.strictEqual(_.result(symbolObject, x), 'foo', 'can use symbols as keys');

var y = Symbol('y');
symbolObject[y] = {};
symbolObject[y][x] = 'bar';
assert.strictEqual(_.result(symbolObject, [y, x]), 'bar', 'can use symbols as keys for deep matching');
}
});

QUnit.test('_.templateSettings.variable', function(assert) {
Expand Down

0 comments on commit 623587a

Please sign in to comment.