mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibJS: Object.preventExtensions should allow property modfication
Existing properties on a non-extensible object should be changable and deletable.
This commit is contained in:
parent
bfbd6df892
commit
93ebd320ef
3 changed files with 39 additions and 17 deletions
|
@ -24,6 +24,20 @@ describe("correct behavior", () => {
|
|||
o.baz = "baz";
|
||||
expect(o.baz).toBeUndefined();
|
||||
});
|
||||
|
||||
test("modifying existing properties", () => {
|
||||
const o = { foo: "bar" };
|
||||
Object.preventExtensions(o);
|
||||
o.foo = "baz";
|
||||
expect(o.foo).toBe("baz");
|
||||
});
|
||||
|
||||
test("deleting existing properties", () => {
|
||||
const o = { foo: "bar" };
|
||||
Object.preventExtensions(o);
|
||||
delete o.foo;
|
||||
expect(o).not.toHaveProperty("foo");
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue