diff --git a/test/built-ins/Temporal/Calendar/prototype/mergeFields/non-string-properties.js b/test/built-ins/Temporal/Calendar/prototype/mergeFields/non-string-properties.js index 2a48dbf62c..68f861c1f7 100644 --- a/test/built-ins/Temporal/Calendar/prototype/mergeFields/non-string-properties.js +++ b/test/built-ins/Temporal/Calendar/prototype/mergeFields/non-string-properties.js @@ -4,7 +4,7 @@ /*--- esid: sec-temporal.calendar.prototype.mergefields -description: Only string keys from the arguments are merged +description: Both string and symbol keys from the arguments are merged info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). @@ -50,6 +50,6 @@ const foo = Symbol("foo"); const bar = Symbol("bar"); assertEntriesEqual( cal.mergeFields({ [foo]: 1 }, { [bar]: 2 }), - [], - "symbol keys are not merged" + [[foo, 1], [bar, 2]], + "symbol keys are also merged" ); diff --git a/test/built-ins/Temporal/Calendar/prototype/mergeFields/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/mergeFields/order-of-operations.js new file mode 100644 index 0000000000..7bc01a5736 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/mergeFields/order-of-operations.js @@ -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");