Temporal: Add order-of-operations tests for toPlainDate

Add order-of-operations tests for toPlainDate for PlainMonthDay
and PlainYearMonth
This commit is contained in:
Tim Chevalier 2025-11-24 10:41:16 -08:00 committed by Philip Chimento
parent 3aa7531077
commit a5eaadfb43
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainmonthday.toplaindate
description: Properties on an object passed to toPlainDate() are accessed in the correct order
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1.7,
calendar: "iso8601",
}, "fields", ["calendar"]);
const pmd = new Temporal.PlainMonthDay(5, 2);
pmd.toPlainDate(fields);
assert.compareArray(actual, expected, "order of operations");

View File

@ -0,0 +1,29 @@
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.toplaindate
description: Properties on an object passed to toPlainDate() 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",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1,
calendar: "iso8601",
}, "fields", ["calendar"]);
const pym = new Temporal.PlainYearMonth(2005, 2);
pym.toPlainDate(fields);
assert.compareArray(actual, expected, "order of operations");