summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/builtins
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-08-26 08:17:44 -0400
committerLinus Groh <mail@linusgroh.de>2021-08-27 12:32:24 +0100
commitca77a7c57311661221c8420f675143152451ac6d (patch)
tree6c27b95c6b6885502aa3e2c2aeec27479784a93f /Userland/Libraries/LibJS/Tests/builtins
parentab7a1dd89ed72322748ecafa2552d84f1a781d10 (diff)
downloadserenity-ca77a7c57311661221c8420f675143152451ac6d.zip
LibJS: Extend Intl.DisplayNames.of to support language tags
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/builtins')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js
index de19b5a725..314ec0599c 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js
@@ -29,6 +29,21 @@ describe("correct behavior", () => {
expect(Intl.DisplayNames.prototype.of).toHaveLength(1);
});
+ test("option type language", () => {
+ const en = new Intl.DisplayNames("en", { type: "language" });
+ expect(en.of("en")).toBe("English");
+
+ const es419 = new Intl.DisplayNames("es-419", { type: "language" });
+ expect(es419.of("en")).toBe("inglés");
+
+ const zhHant = new Intl.DisplayNames(["zh-Hant"], { type: "language" });
+ expect(zhHant.of("en")).toBe("英文");
+
+ expect(en.of("zz")).toBe("zz");
+ expect(es419.of("zz")).toBe("zz");
+ expect(zhHant.of("zz")).toBe("zz");
+ });
+
test("option type region", () => {
const en = new Intl.DisplayNames("en", { type: "region" });
expect(en.of("US")).toBe("United States");