mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 04:37:22 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
|
@ -0,0 +1,79 @@
|
|||
test("length is 3", () => {
|
||||
expect(Reflect.defineProperty).toHaveLength(3);
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("target must be an object", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.defineProperty(value);
|
||||
}).toThrowWithMessage(TypeError, `${value} is not an object`);
|
||||
});
|
||||
});
|
||||
|
||||
test("descriptor must be an object", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.defineProperty({}, "foo", value);
|
||||
}).toThrowWithMessage(TypeError, `${value} is not an object`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("initial value and non-writable", () => {
|
||||
var o = {};
|
||||
|
||||
expect(o.foo).toBeUndefined();
|
||||
expect(Reflect.defineProperty(o, "foo", { value: 1, writable: false })).toBeTrue();
|
||||
expect(o.foo).toBe(1);
|
||||
o.foo = 2;
|
||||
expect(o.foo).toBe(1);
|
||||
});
|
||||
|
||||
test("initial value and writable", () => {
|
||||
var o = {};
|
||||
|
||||
expect(o.foo).toBeUndefined();
|
||||
expect(Reflect.defineProperty(o, "foo", { value: 1, writable: true })).toBeTrue();
|
||||
expect(o.foo).toBe(1);
|
||||
o.foo = 2;
|
||||
expect(o.foo).toBe(2);
|
||||
});
|
||||
|
||||
test("can redefine value of configurable, writable property", () => {
|
||||
var o = {};
|
||||
|
||||
expect(o.foo).toBeUndefined();
|
||||
expect(
|
||||
Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: true })
|
||||
).toBeTrue();
|
||||
expect(o.foo).toBe(1);
|
||||
expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue();
|
||||
expect(o.foo).toBe(2);
|
||||
});
|
||||
|
||||
test("can redefine value of configurable, non-writable property", () => {
|
||||
var o = {};
|
||||
|
||||
expect(o.foo).toBeUndefined();
|
||||
expect(
|
||||
Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: false })
|
||||
).toBeTrue();
|
||||
expect(o.foo).toBe(1);
|
||||
expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue();
|
||||
expect(o.foo).toBe(2);
|
||||
});
|
||||
|
||||
test("cannot redefine value of non-configurable, non-writable property", () => {
|
||||
var o = {};
|
||||
|
||||
expect(o.foo).toBeUndefined();
|
||||
expect(
|
||||
Reflect.defineProperty(o, "foo", { value: 1, configurable: false, writable: false })
|
||||
).toBeTrue();
|
||||
expect(o.foo).toBe(1);
|
||||
expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeFalse();
|
||||
expect(o.foo).toBe(1);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue