mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Implement Temporal.PlainDateTime.prototype.toLocaleString
This commit is contained in:
parent
b2bbd4d2b8
commit
2a98b521b4
Notes:
sideshowbarker
2024-07-18 01:32:19 +09:00
Author: https://github.com/Lubrsi
Commit: 2a98b521b4
Pull-request: https://github.com/SerenityOS/serenity/pull/10771
Reviewed-by: https://github.com/linusg ✅
3 changed files with 32 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
describe("correct behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.PlainDateTime.prototype.toLocaleString).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300);
|
||||
expect(plainDateTime.toLocaleString()).toBe("2021-11-03T01:33:05.1002003");
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.PlainDateTime object", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainDateTime.prototype.toLocaleString.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.PlainDateTime");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue