packages/babel-plugin-transform-new-target/test/fixtures/exec/class-extended.js
raw| 1 | "use strict"; |
| 2 | |
| 3 | const targets = []; |
| 4 | class Foo { |
| 5 | constructor() { |
| 6 | targets.push(new.target); |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | class Bar extends Foo { |
| 11 | constructor() { |
| 12 | super(); |
| 13 | targets.push(new.target); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | new Foo; |
| 18 | new Bar; |
| 19 | |
| 20 | expect(targets[0]).toBe(Foo); |
| 21 | expect(targets[1]).toBe(Bar); |
| 22 | expect(targets[2]).toBe(Bar); |