diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-09-02 19:03:41 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-04 13:51:40 +0100 |
commit | 0b1f5118d568e3c7a326ea0f0e8c29edc90e13a0 (patch) | |
tree | d16ff3d7c849b2b9a33d44eb0124900a3defdbdc /Userland/Libraries/LibJS/Tests/builtins | |
parent | 03d7f01e0ccfde1c37385c58097337de4c9df2ab (diff) | |
download | serenity-0b1f5118d568e3c7a326ea0f0e8c29edc90e13a0.zip |
LibJS: Implement Intl.Locale.prototype.maximize
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/builtins')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js new file mode 100644 index 0000000000..8f6bd34191 --- /dev/null +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js @@ -0,0 +1,32 @@ +test("length is 0", () => { + expect(Intl.Locale.prototype.maximize).toHaveLength(0); +}); + +test("normal behavior", () => { + expect(new Intl.Locale("en").maximize().toString()).toBe("en-Latn-US"); + + expect(new Intl.Locale("en-Latn").maximize().toString()).toBe("en-Latn-US"); + expect(new Intl.Locale("en-Shaw").maximize().toString()).toBe("en-Shaw-GB"); + expect(new Intl.Locale("en-Arab").maximize().toString()).toBe("en-Arab-US"); + + expect(new Intl.Locale("en-US").maximize().toString()).toBe("en-Latn-US"); + expect(new Intl.Locale("en-GB").maximize().toString()).toBe("en-Latn-GB"); + expect(new Intl.Locale("en-FR").maximize().toString()).toBe("en-Latn-FR"); + + expect(new Intl.Locale("it-Kana-CA").maximize().toString()).toBe("it-Kana-CA"); + + expect(new Intl.Locale("und").maximize().toString()).toBe("en-Latn-US"); + expect(new Intl.Locale("und-Thai").maximize().toString()).toBe("th-Thai-TH"); + expect(new Intl.Locale("und-419").maximize().toString()).toBe("es-Latn-419"); + expect(new Intl.Locale("und-150").maximize().toString()).toBe("ru-Cyrl-RU"); + expect(new Intl.Locale("und-AT").maximize().toString()).toBe("de-Latn-AT"); + expect(new Intl.Locale("und-Cyrl-RO").maximize().toString()).toBe("bg-Cyrl-RO"); + expect(new Intl.Locale("und-AQ").maximize().toString()).toBe("und-Latn-AQ"); +}); + +test("keywords are preserved", () => { + expect(new Intl.Locale("en-u-ca-abc").maximize().toString()).toBe("en-Latn-US-u-ca-abc"); + expect(new Intl.Locale("en", { calendar: "abc" }).maximize().toString()).toBe( + "en-Latn-US-u-ca-abc" + ); +}); |