-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for PlainMonthDay#toString().
- Loading branch information
Showing
6 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
polyfill/test/PlainMonthDay/prototype/toString/calendarname-always.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plainmonthday.protoype.tostring | ||
description: If calendarName is "always", the calendar ID should be included. | ||
features: [Temporal] | ||
---*/ | ||
|
||
const tests = [ | ||
[[], "05-02[u-ca=iso8601]"], | ||
[[{ toString() { return "custom"; } }], "1972-05-02[u-ca=custom]"], | ||
[[{ toString() { return "iso8601"; } }], "05-02[u-ca=iso8601]"], | ||
[[{ toString() { return "ISO8601"; } }], "1972-05-02[u-ca=ISO8601]"], | ||
[[{ toString() { return "\u0131so8601"; } }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i | ||
]; | ||
|
||
for (const [args, expected] of tests) { | ||
const monthday = new Temporal.PlainMonthDay(5, 2, ...args); | ||
const result = monthday.toString({ calendarName: "always" }); | ||
assert.sameValue(result, expected); | ||
} |
22 changes: 22 additions & 0 deletions
22
polyfill/test/PlainMonthDay/prototype/toString/calendarname-auto.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plainmonthday.protoype.tostring | ||
description: If calendarName is "auto", "iso8601" should be omitted. | ||
features: [Temporal] | ||
---*/ | ||
|
||
const tests = [ | ||
[[], "05-02"], | ||
[[{ toString() { return "custom"; } }], "1972-05-02[u-ca=custom]"], | ||
[[{ toString() { return "iso8601"; } }], "05-02"], | ||
[[{ toString() { return "ISO8601"; } }], "1972-05-02[u-ca=ISO8601]"], | ||
[[{ toString() { return "\u0131so8601"; } }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i | ||
]; | ||
|
||
for (const [args, expected] of tests) { | ||
const monthday = new Temporal.PlainMonthDay(5, 2, ...args); | ||
const result = monthday.toString({ calendarName: "auto" }); | ||
assert.sameValue(result, expected); | ||
} |
22 changes: 22 additions & 0 deletions
22
polyfill/test/PlainMonthDay/prototype/toString/calendarname-never.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plainmonthday.protoype.tostring | ||
description: If calendarName is "never", the calendar ID should be omitted. | ||
features: [Temporal] | ||
---*/ | ||
|
||
const tests = [ | ||
[[], "05-02"], | ||
[[{ toString() { return "custom"; } }], "1972-05-02"], | ||
[[{ toString() { return "iso8601"; } }], "05-02"], | ||
[[{ toString() { return "ISO8601"; } }], "1972-05-02"], | ||
[[{ toString() { return "\u0131so8601"; } }], "1972-05-02"], // dotless i | ||
]; | ||
|
||
for (const [args, expected] of tests) { | ||
const monthday = new Temporal.PlainMonthDay(5, 2, ...args); | ||
const result = monthday.toString({ calendarName: "never" }); | ||
assert.sameValue(result, expected); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters