mirror of
https://github.com/tc39/test262.git
synced 2025-09-25 19:18:48 +02:00
This contains tests for the normative PR https://github.com/tc39/proposal-temporal/pull/2437, which is to be presented for consensus to TC39 in the upcoming plenary meeting. That PR changes the observable order of property accesses to be alphabetical where possible.
36 lines
1008 B
JavaScript
36 lines
1008 B
JavaScript
// 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.plaindate.from
|
|
description: Verify the result of calendar.fields() is treated correctly.
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
class CustomCalendar extends Temporal.Calendar {
|
|
constructor() {
|
|
super("iso8601");
|
|
}
|
|
dateFromFields(fields) {
|
|
assert.compareArray(Object.keys(fields), ["a", "b"]);
|
|
return new Temporal.PlainDate(2020, 7, 4);
|
|
}
|
|
fields(fields) {
|
|
assert.compareArray(fields, ["day", "month", "monthCode", "year"]);
|
|
return ["b", "a"];
|
|
}
|
|
}
|
|
|
|
const calendar = new CustomCalendar();
|
|
const actual = [];
|
|
const item = TemporalHelpers.propertyBagObserver(actual, { calendar }, "item");
|
|
|
|
const plainDate = Temporal.PlainDate.from(item);
|
|
TemporalHelpers.assertPlainDate(plainDate, 2020, 7, "M07", 4);
|
|
assert.compareArray(actual, [
|
|
"get item.calendar",
|
|
"get item.a",
|
|
"get item.b",
|
|
]);
|