Add tests for setting the [[Prototype]] of clones for values where constructor is incorrect.

This commit is contained in:
John-David Dalton
2016-02-19 08:18:56 -08:00
parent ad5e30e189
commit 8698a5e0e8

View File

@@ -2664,12 +2664,20 @@
assert.deepEqual(actual, { 'b': 1 });
});
QUnit.test('`_.' + methodName + '` should create clone with the same `[[Prototype]]` as `value`', function(assert) {
QUnit.test('`_.' + methodName + '` should set the `[[Prototype]]` of a clone', function(assert) {
assert.expect(1);
assert.ok(func(new Foo) instanceof Foo);
});
QUnit.test('`_.' + methodName + '` should set the `[[Prototype]]` of a clone even when the `constructor` is incorrect', function(assert) {
assert.expect(1);
Foo.prototype.constructor = Object;
assert.ok(func(new Foo) instanceof Foo);
Foo.prototype.constructor = Foo;
});
QUnit.test('`_.' + methodName + '` should ensure `value` constructor is a function before using its `[[Prototype]]`', function(assert) {
assert.expect(1);