mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Add tests for setting the [[Prototype]] of clones for values where constructor is incorrect.
This commit is contained in:
10
test/test.js
10
test/test.js
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user