mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibJS: Implement Intl.DisplayNames.prototype.resolvedOptions
This commit is contained in:
parent
17bb652775
commit
a061d874c9
4 changed files with 61 additions and 0 deletions
|
@ -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",
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue