mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:17:34 +00:00
LibJS: Avoid calling ToString on calendar when calendarName is "never"
This is a normative change in the Temporal spec. See: -6122f4e
-cf586bc
This commit is contained in:
parent
0d7b634313
commit
54bb6bf2c0
8 changed files with 115 additions and 33 deletions
|
@ -52,6 +52,34 @@ describe("correct behavior", () => {
|
|||
expect(plainDateTime.toString(pluralOptions)).toBe(expected);
|
||||
}
|
||||
});
|
||||
|
||||
test("doesn't call ToString on calendar if calenderName option is 'never'", () => {
|
||||
let calledToString = false;
|
||||
const calendar = {
|
||||
toString() {
|
||||
calledToString = true;
|
||||
return "nocall";
|
||||
},
|
||||
};
|
||||
|
||||
const plainDateTime = new Temporal.PlainDateTime(
|
||||
2022,
|
||||
8,
|
||||
8,
|
||||
14,
|
||||
38,
|
||||
40,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
calendar
|
||||
);
|
||||
const options = {
|
||||
calendarName: "never",
|
||||
};
|
||||
expect(plainDateTime.toString(options)).toBe("2022-08-08T14:38:40.1002003");
|
||||
expect(calledToString).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue