Add support for creating clones with the same [[Prototype]] as value.

This commit is contained in:
John-David Dalton
2016-01-03 18:49:32 -06:00
parent f39fdc42f6
commit ed3f8cc39d
2 changed files with 14 additions and 9 deletions

View File

@@ -2263,7 +2263,7 @@
(function() {
function Foo() { this.a = 1; }
Foo.prototype = { 'b': 1 };
Foo.prototype.b = 1;
Foo.c = function() {};
if (Map) {
@@ -2451,6 +2451,12 @@
assert.strictEqual(actual.lastIndex, 3);
});
QUnit.test('`_.' + methodName + '` should create clone with the same `[[Prototype]]` as `value`', function(assert) {
assert.expect(1);
assert.ok(func(new Foo) instanceof Foo);
});
QUnit.test('`_.' + methodName + '` should clone properties that shadow those on `Object.prototype`', function(assert) {
assert.expect(2);