mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +00:00
LibJS: Implement Temporal.Duration.prototype.sign/blank
This commit is contained in:
parent
5fe0d3352d
commit
dfaa3bf649
Notes:
github-actions[bot]
2024-11-21 00:06:14 +00:00
Author: https://github.com/trflynn89
Commit: dfaa3bf649
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2431
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/shannonbooth ✅
4 changed files with 66 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
describe("correct behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
const nonBlankDuration = new Temporal.Duration(123);
|
||||
expect(nonBlankDuration.blank).toBeFalse();
|
||||
|
||||
const blankDuration = new Temporal.Duration(0);
|
||||
expect(blankDuration.blank).toBeTrue();
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.Duration object", () => {
|
||||
expect(() => {
|
||||
Reflect.get(Temporal.Duration.prototype, "blank", "foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Duration");
|
||||
});
|
||||
});
|
|
@ -0,0 +1,17 @@
|
|||
describe("correct behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
const positiveDuration = new Temporal.Duration(123);
|
||||
expect(positiveDuration.sign).toBe(1);
|
||||
|
||||
const negativeDuration = new Temporal.Duration(-123);
|
||||
expect(negativeDuration.sign).toBe(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.Duration object", () => {
|
||||
expect(() => {
|
||||
Reflect.get(Temporal.Duration.prototype, "sign", "foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Duration");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue