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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
// Copyright 2018 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-createdatetimeformat
description: Checks the order of getting options for the DateTimeFormat constructor.
includes: [compareArray.js]
features: [Intl.DateTimeFormat-datetimestyle]
---*/
// To be merged into constructor-options-order.js when the feature is removed.
const expected = [
// CreateDateTimeFormat step 4.
"localeMatcher",
// CreateDateTimeFormat step 12.
"hour12",
// CreateDateTimeFormat step 13.
"hourCycle",
// CreateDateTimeFormat step 29.
"timeZone",
// CreateDateTimeFormat step 36.
"weekday",
"era",
"year",
"month",
"day",
"hour",
"minute",
"second",
"timeZoneName",
"formatMatcher",
// CreateDateTimeFormat step 38.
"dateStyle",
// CreateDateTimeFormat step 40.
"timeStyle",
];
const actual = [];
const options = {
get dateStyle() {
actual.push("dateStyle");
return undefined;
},
get day() {
actual.push("day");
return "numeric";
},
get era() {
actual.push("era");
return "long";
},
get formatMatcher() {
actual.push("formatMatcher");
return "best fit";
},
get hour() {
actual.push("hour");
return "numeric";
},
get hour12() {
actual.push("hour12");
return true;
},
get hourCycle() {
actual.push("hourCycle");
return "h24";
},
get localeMatcher() {
actual.push("localeMatcher");
return "best fit";
},
get minute() {
actual.push("minute");
return "numeric";
},
get month() {
actual.push("month");
return "numeric";
},
get second() {
actual.push("second");
return "numeric";
},
get timeStyle() {
actual.push("timeStyle");
return undefined;
},
get timeZone() {
actual.push("timeZone");
return "UTC";
},
get timeZoneName() {
actual.push("timeZoneName");
return "long";
},
get weekday() {
actual.push("weekday");
return "long";
},
get year() {
actual.push("year");
return "numeric";
},
};
new Intl.DateTimeFormat("en", options);
assert.compareArray(actual, expected);
reportCompare(0, 0);
|