Debian Codegraph @

packages/babel-plugin-transform-classes/test/fixtures/regression/8499/input.js

raw
1 const oldReflect = this.Reflect;
2 const oldHTMLElement = this.HTMLElement;
3
4 try {
5 // Pretend that `Reflect.construct` isn't supported.
6 this.Reflect = undefined;
7
8 this.HTMLElement = function() {
9 // Here, `this.HTMLElement` is this function, not the original HTMLElement
10 // constructor. `this.constructor` should be this function too, but isn't.
11 constructor = this.constructor;
12 };
13
14 var constructor;
15
16 class CustomElement extends HTMLElement {};
17 new CustomElement();
18
19 expect(constructor).toBe(CustomElement);
20 } finally {
21 // Restore original env
22 this.Reflect = oldReflect;
23 this.HTMLElement = oldHTMLElement;
24 }
25
26