Fix ReferenceError in the wrapNativeSuper helper (#8100)

Fix a ReferenceError caused by a typo (`_construct` instead of
`construct`) in the external `wrapNativeSuper` helper. (The typo
doesn't usually cause an error in inline helpers because `_construct`
happens to be the default name given to the `construct` helper
function.)
This commit is contained in:
chocolateboy
2018-06-02 16:00:02 +00:00
committed by Nicolò Ribaudo
parent b8dcd6f593
commit 2abd7839e1
6 changed files with 38 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ var env = {
Array: null,
};
// Wee need to use "with" to avoid leaking the modified Array to other tests.
// We need to use "with" to avoid leaking the modified Array to other tests.
with (env) {
class List extends Array {}
expect(List.prototype.__proto__).toBeUndefined();

View File

@@ -6,7 +6,7 @@ var env = {
}
};
// Wee need to use "with" to avoid leaking the modified Array to other tests.
// We need to use "with" to avoid leaking the modified Array to other tests.
with (env) {
class List extends Array {};
new List();

View File

@@ -0,0 +1,25 @@
// basic sanity check to confirm the external wrapNativeSuper helper works
class Test1 extends Array {
name() {
return 'test1';
}
}
class Test2 extends Array {
name() {
return 'test2';
}
}
var t1 = new Test1();
var t2 = new Test2();
expect(Test1).not.toBe(Test2);
expect(t1).not.toBe(t2);
expect(t1.name()).toBe('test1');
expect(t2.name()).toBe('test2');
expect(t1).toBeInstanceOf(Test1);
expect(t2).toBeInstanceOf(Test2);
expect(t1).toBeInstanceOf(Array);
expect(t2).toBeInstanceOf(Array);

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-classes","transform-block-scoping","external-helpers"]
}