mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Use a custom property_name_to_value method instead of to_value
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 10:23:00 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/ce59e49e27b Pull-request: https://github.com/SerenityOS/serenity/pull/8294 Reviewed-by: https://github.com/IdanHo Reviewed-by: https://github.com/linusg ✅
@@ -20,6 +20,21 @@ describe("[[Set]] trap normal behavior", () => {
|
||||
p.foo = 10;
|
||||
});
|
||||
|
||||
test("correct arguments passed to trap even for number", () => {
|
||||
let o = {};
|
||||
let p = new Proxy(o, {
|
||||
set(target, prop, value, receiver) {
|
||||
expect(target).toBe(o);
|
||||
expect(prop).toBe("1");
|
||||
expect(value).toBe(10);
|
||||
expect(receiver).toBe(p);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
p[1] = 10;
|
||||
});
|
||||
|
||||
test("conditional return value", () => {
|
||||
let p = new Proxy(
|
||||
{},
|
||||
|
||||
Reference in New Issue
Block a user