test262/test/built-ins/Temporal/PlainMonthDay/from/order-of-operations.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

// 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 = [
"get fields.calendar",
"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",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1.7,
}, "fields");
const result = Temporal.PlainMonthDay.from(fields);
TemporalHelpers.assertPlainMonthDay(result, "M01", 1);
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
assert.compareArray(actual, expected, "order of operations");