diff options
Diffstat (limited to 'Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js')
-rw-r--r-- | Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js index c78235884e..ef1a75c48a 100644 --- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js +++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js @@ -43,6 +43,21 @@ describe("[[Set]] trap normal behavior", () => { p[Symbol.hasInstance] = "foo" expect(p[Symbol.hasInstance]).toBe("foo"); }); + + test("custom receiver value", () => { + const o = {}; + const r = {}; + let p = new Proxy(o, { + set(target, property, value, receiver) { + receiver[property] = value; + return true; + }, + }); + + expect(Reflect.set(p, "foo", 42, r)).toBe(true); + expect(o.foo).toBeUndefined(); + expect(r.foo).toBe(42); + }); }); describe("[[Set]] invariants", () => { |