mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
LibJS: Allow super property lookup and new.target in static init blocks
This commit is contained in:
parent
92672b1520
commit
45578f58dc
2 changed files with 28 additions and 1 deletions
|
@ -46,3 +46,29 @@ test("correct this", () => {
|
|||
|
||||
expect(thisValue).toBe(A);
|
||||
});
|
||||
|
||||
describe("class like constructs can be used inside", () => {
|
||||
test("can use new.target", () => {
|
||||
let value = 1;
|
||||
class C {
|
||||
static {
|
||||
value = new.target;
|
||||
}
|
||||
}
|
||||
expect(value).toBeUndefined();
|
||||
});
|
||||
|
||||
test("can use super property lookup", () => {
|
||||
function parent() {}
|
||||
parent.val = 3;
|
||||
|
||||
let hit = false;
|
||||
class C extends parent {
|
||||
static {
|
||||
hit = true;
|
||||
expect(super.val).toBe(3);
|
||||
}
|
||||
}
|
||||
expect(hit).toBeTrue();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue