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
|
// |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.mergefields
description: Properties on objects passed to mergeFields() are accessed in the correct order
features: [Temporal]
includes: [compareArray.js, temporalHelpers.js]
---*/
const expected = [
// CopyDataProperties on fields
"ownKeys fields",
"getOwnPropertyDescriptor fields.year",
"get fields.year",
"getOwnPropertyDescriptor fields.month",
"get fields.month",
"getOwnPropertyDescriptor fields.day",
"get fields.day",
"getOwnPropertyDescriptor fields.extra",
"get fields.extra",
// CopyDataProperties on additionalFields
"ownKeys additionalFields",
"getOwnPropertyDescriptor additionalFields[3]",
"get additionalFields[3]",
"getOwnPropertyDescriptor additionalFields.monthCode",
"get additionalFields.monthCode",
"getOwnPropertyDescriptor additionalFields[Symbol('extra')]",
"get additionalFields[Symbol('extra')]",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 2022,
month: 10,
day: 17,
extra: "extra property",
}, "fields");
const additionalFields = TemporalHelpers.propertyBagObserver(actual, {
[Symbol("extra")]: "extra symbol property",
monthCode: "M10",
3: "extra array index property",
}, "additionalFields");
const instance = new Temporal.Calendar("iso8601");
instance.mergeFields(fields, additionalFields);
assert.compareArray(actual, expected, "order of observable operations");
reportCompare(0, 0);
|