blob: 0435ec2bae6d0b543b040da0d19c6a399b930831 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright 2020 Google Inc, Igalia S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializedatetimeformat
description: >
Tests that the options numberingSystem and calendar are mapped
to lower case properly.
author: Caio Lima
---*/
let defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
let supportedNumberingSystems = ["latn", "arab"].filter(nu =>
new Intl.DateTimeFormat(defaultLocale + "-u-nu-" + nu)
.resolvedOptions().numberingSystem === nu
);
if (supportedNumberingSystems.includes("latn")) {
let dateTimeFormat = new Intl.DateTimeFormat(defaultLocale + "-u-nu-lATn");
assert.sameValue(dateTimeFormat.resolvedOptions().numberingSystem, "latn", "Numbering system option should be in lower case");
}
if (supportedNumberingSystems.includes("arab")) {
let dateTimeFormat = new Intl.DateTimeFormat(defaultLocale + "-u-nu-Arab");
assert.sameValue(dateTimeFormat.resolvedOptions().numberingSystem, "arab", "Numbering system option should be in lower case");
}
let supportedCalendars = ["gregory", "chinese"].filter(ca =>
new Intl.DateTimeFormat(defaultLocale + "-u-ca-" + ca)
.resolvedOptions().calendar === ca
);
if (supportedCalendars.includes("gregory")) {
let dateTimeFormat = new Intl.DateTimeFormat(defaultLocale + "-u-ca-Gregory");
assert.sameValue(dateTimeFormat.resolvedOptions().calendar, "gregory", "Calendar option should be in lower case");
}
if (supportedCalendars.includes("chinese")) {
let dateTimeFormat = new Intl.DateTimeFormat(defaultLocale + "-u-ca-CHINESE");
assert.sameValue(dateTimeFormat.resolvedOptions().calendar, "chinese", "Calendar option should be in lower case");
}
reportCompare(0, 0);
|