2021-09-29 21:48:22 +02:00
|
|
|
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-temporal.plainmonthday.from
|
|
|
|
description: Properties on an object passed to from() are accessed in the correct order
|
|
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
|
|
features: [Temporal]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
const expected = [
|
2023-03-03 02:40:57 +01:00
|
|
|
// CopyDataProperties
|
|
|
|
"ownKeys options",
|
|
|
|
"getOwnPropertyDescriptor options.overflow",
|
|
|
|
"get options.overflow",
|
|
|
|
"getOwnPropertyDescriptor options.extra",
|
|
|
|
"get options.extra",
|
2022-09-20 20:22:00 +02:00
|
|
|
"get fields.calendar",
|
2023-01-28 03:30:11 +01:00
|
|
|
"has fields.calendar.dateAdd",
|
|
|
|
"has fields.calendar.dateFromFields",
|
|
|
|
"has fields.calendar.dateUntil",
|
|
|
|
"has fields.calendar.day",
|
|
|
|
"has fields.calendar.dayOfWeek",
|
|
|
|
"has fields.calendar.dayOfYear",
|
|
|
|
"has fields.calendar.daysInMonth",
|
|
|
|
"has fields.calendar.daysInWeek",
|
|
|
|
"has fields.calendar.daysInYear",
|
|
|
|
"has fields.calendar.fields",
|
|
|
|
"has fields.calendar.id",
|
|
|
|
"has fields.calendar.inLeapYear",
|
|
|
|
"has fields.calendar.mergeFields",
|
|
|
|
"has fields.calendar.month",
|
|
|
|
"has fields.calendar.monthCode",
|
|
|
|
"has fields.calendar.monthDayFromFields",
|
|
|
|
"has fields.calendar.monthsInYear",
|
|
|
|
"has fields.calendar.weekOfYear",
|
|
|
|
"has fields.calendar.year",
|
|
|
|
"has fields.calendar.yearMonthFromFields",
|
|
|
|
"has fields.calendar.yearOfWeek",
|
2023-03-11 21:46:51 +01:00
|
|
|
// lookup
|
2022-11-04 01:49:38 +01:00
|
|
|
"get fields.calendar.fields",
|
2023-03-11 21:46:51 +01:00
|
|
|
"get fields.calendar.monthDayFromFields",
|
|
|
|
// CalendarFields
|
2022-11-04 01:49:38 +01:00
|
|
|
"call fields.calendar.fields",
|
|
|
|
// PrepareTemporalFields
|
2022-09-20 20:22:00 +02:00
|
|
|
"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",
|
2022-11-04 01:49:38 +01:00
|
|
|
// CalendarMonthDayFromFields
|
|
|
|
"call fields.calendar.monthDayFromFields",
|
2022-11-04 01:46:53 +01:00
|
|
|
// inside Calendar.p.monthDayFromFields
|
|
|
|
"get options.overflow.toString",
|
|
|
|
"call options.overflow.toString",
|
2021-09-29 21:48:22 +02:00
|
|
|
];
|
|
|
|
const actual = [];
|
2022-11-04 01:49:38 +01:00
|
|
|
|
2022-09-20 20:22:00 +02:00
|
|
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
2021-09-29 21:48:22 +02:00
|
|
|
year: 1.7,
|
|
|
|
month: 1.7,
|
|
|
|
monthCode: "M01",
|
|
|
|
day: 1.7,
|
2022-11-04 01:49:38 +01:00
|
|
|
calendar: TemporalHelpers.calendarObserver(actual, "fields.calendar"),
|
2022-09-20 20:22:00 +02:00
|
|
|
}, "fields");
|
2022-11-04 01:46:53 +01:00
|
|
|
|
2023-03-03 02:40:57 +01:00
|
|
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
|
|
|
overflow: "constrain",
|
|
|
|
extra: "property",
|
|
|
|
}, "options");
|
2022-11-04 01:46:53 +01:00
|
|
|
|
|
|
|
Temporal.PlainMonthDay.from(fields, options);
|
2021-09-29 21:48:22 +02:00
|
|
|
assert.compareArray(actual, expected, "order of operations");
|