mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
Libraries: Move to Userland/Libraries/
This commit is contained in:
parent
dc28c07fa5
commit
13d7c09125
Notes:
sideshowbarker
2024-07-18 23:53:55 +09:00
Author: https://github.com/awesomekling
Commit: 13d7c09125
1857 changed files with 266 additions and 274 deletions
|
@ -1,35 +0,0 @@
|
|||
test("extending function", () => {
|
||||
class A extends function () {
|
||||
this.foo = 10;
|
||||
} {}
|
||||
|
||||
expect(new A().foo).toBe(10);
|
||||
});
|
||||
|
||||
test("extending null", () => {
|
||||
class A extends null {}
|
||||
|
||||
expect(Object.getPrototypeOf(A.prototype)).toBeNull();
|
||||
|
||||
expect(() => {
|
||||
new A();
|
||||
}).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
|
||||
});
|
||||
|
||||
test("extending String", () => {
|
||||
class MyString extends String {}
|
||||
|
||||
const ms = new MyString("abc");
|
||||
expect(ms).toBeInstanceOf(MyString);
|
||||
expect(ms).toBeInstanceOf(String);
|
||||
expect(ms.charAt(1)).toBe("b");
|
||||
|
||||
class MyString2 extends MyString {
|
||||
charAt(i) {
|
||||
return `#${super.charAt(i)}`;
|
||||
}
|
||||
}
|
||||
|
||||
const ms2 = new MyString2("abc");
|
||||
expect(ms2.charAt(1)).toBe("#b");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue