1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

LibJS: Implement Intl.DisplayNames.prototype.resolvedOptions

This commit is contained in:
Timothy Flynn 2021-08-24 23:26:44 -04:00 committed by Linus Groh
parent 17bb652775
commit a061d874c9
4 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,31 @@
describe("correct behavior", () => {
test("length is 0", () => {
expect(Intl.DisplayNames.prototype.resolvedOptions).toHaveLength(0);
});
test("all valid types", () => {
const en = new Intl.DisplayNames("en", { type: "region" });
expect(en.resolvedOptions()).toEqual({
locale: "en",
style: "long",
type: "region",
fallback: "code",
});
const es419 = new Intl.DisplayNames("es-419", { type: "script", fallback: "none" });
expect(es419.resolvedOptions()).toEqual({
locale: "es-419",
style: "long",
type: "script",
fallback: "none",
});
const zhHant = new Intl.DisplayNames(["zh-Hant"], { type: "language", style: "short" });
expect(zhHant.resolvedOptions()).toEqual({
locale: "zh-Hant",
style: "short",
type: "language",
fallback: "code",
});
});
});