mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibJS: Implement Intl.Locale.prototype.baseName
This commit is contained in:
parent
27fc3cfe75
commit
21b3c5edba
Notes:
sideshowbarker
2024-07-18 04:53:07 +09:00
Author: https://github.com/trflynn89
Commit: 21b3c5edba
Pull-request: https://github.com/SerenityOS/serenity/pull/9749
Reviewed-by: https://github.com/linusg ✅
4 changed files with 44 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
describe("errors", () => {
|
||||
test("called on non-Locale object", () => {
|
||||
expect(() => {
|
||||
Intl.Locale.prototype.baseName;
|
||||
}).toThrowWithMessage(TypeError, "Not a Intl.Locale object");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
expect(new Intl.Locale("en").baseName).toBe("en");
|
||||
expect(new Intl.Locale("en-Latn").baseName).toBe("en-Latn");
|
||||
expect(new Intl.Locale("en-GB").baseName).toBe("en-GB");
|
||||
expect(new Intl.Locale("en", { script: "Latn" }).baseName).toBe("en-Latn");
|
||||
expect(new Intl.Locale("en", { region: "GB" }).baseName).toBe("en-GB");
|
||||
|
||||
expect(new Intl.Locale("en-u-ca-abc").baseName).toBe("en");
|
||||
expect(new Intl.Locale("en", { calendar: "abc" }).baseName).toBe("en");
|
||||
expect(new Intl.Locale("en-x-abcd").baseName).toBe("en");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue