-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporal: Test Calendar.p.mergeFields enumeration changes
This tests the normative changes in tc39/proposal-temporal#2245, which achieved consensus in the July 2022 TC39 meeting, specifically as they apply to the Temporal.Calendar.prototype.mergeFields method. Due to the use of the pre-existing spec operation CopyDataProperties, now symbol keys are merged into the return value, and the order of observable property operations has changed from a batch of [[GetOwnProperty]] followed by a batch of [[Get]], to a series of interleaved [[GetOwnProperty]]/[[Get]] pairs.
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/built-ins/Temporal/Calendar/prototype/mergeFields/order-of-operations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 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 = [ | ||
"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", | ||
"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"); |