mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-05 18:52:56 +00:00
LibJS: Add Symbol.hasInstance tests
This commit is contained in:
parent
b0296735a5
commit
6075defd55
Notes:
sideshowbarker
2024-07-19 04:49:44 +09:00
Author: https://github.com/mattco98
Commit: 6075defd55
Pull-request: https://github.com/SerenityOS/serenity/pull/2770
2 changed files with 17 additions and 0 deletions
9
Libraries/LibJS/Tests/custom-@@hasInstance.js
Normal file
9
Libraries/LibJS/Tests/custom-@@hasInstance.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
test("basic functionality", () => {
|
||||
function Foo() {}
|
||||
Foo[Symbol.hasInstance] = value => {
|
||||
return value === 2;
|
||||
};
|
||||
|
||||
expect(new Foo() instanceof Foo).toBeFalse();
|
||||
expect(2 instanceof Foo).toBeTrue();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue