Ensure _.defaults assigns properties that shadow those on Object.prototype.

This commit is contained in:
John-David Dalton
2015-11-08 12:16:47 -08:00
parent 73d68c9609
commit 8a3842b788
2 changed files with 25 additions and 15 deletions

View File

@@ -3626,6 +3626,13 @@
var actual = _.defaults({ 'a': undefined }, { 'a': 1 });
assert.strictEqual(actual.a, 1);
});
QUnit.test('should assign properties that shadow those on `Object.prototype`', function(assert) {
assert.expect(1);
var actual = _.defaults({}, { 'constructor': 1 });
assert.strictEqual(actual.constructor, 1);
});
}());
/*--------------------------------------------------------------------------*/