LibJS: Use a custom property_name_to_value method instead of to_value

This commit is contained in:
davidot
2021-07-05 01:59:50 +02:00
committed by Linus Groh
parent 721238f41c
commit ce59e49e27
Notes: sideshowbarker 2024-07-18 10:23:00 +09:00
7 changed files with 104 additions and 6 deletions

View File

@@ -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(
{},