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
|
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.datefromfields
description: Properties on objects passed to dateFromFields() are accessed in the correct order
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const expected = [
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
"get fields.month",
"get fields.month.valueOf",
"call fields.month.valueOf",
"get fields.monthCode",
"get fields.monthCode.toString",
"call fields.monthCode.toString",
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const instance = new Temporal.Calendar("iso8601");
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1.7,
}, "fields");
const options = TemporalHelpers.propertyBagObserver(actual, {
overflow: "reject",
}, "options");
const result = instance.dateFromFields(fields, options);
TemporalHelpers.assertPlainDate(result, 1, 1, "M01", 1, "date result");
assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string");
assert.compareArray(actual, expected, "order of operations");
reportCompare(0, 0);
|