mirror of https://github.com/tc39/test262.git
26 lines
803 B
JavaScript
26 lines
803 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.plainyearmonth.prototype.from
|
|
description: >
|
|
When calendar.fields is undefined, from() doesn't perform an
|
|
observable array iteration to convert the property bag to PlainYearMonth
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const calendar = new Temporal.Calendar("iso8601");
|
|
calendar.fields = undefined;
|
|
|
|
// Detect observable array iteration:
|
|
const oldIterator = Array.prototype[Symbol.iterator];
|
|
Array.prototype[Symbol.iterator] = function () {
|
|
throw new Test262Error(`array shouldn't be iterated: ${new Error().stack}`);
|
|
};
|
|
|
|
const arg = { year: 1981, month: 12, calendar };
|
|
|
|
Temporal.PlainYearMonth.from(arg);
|
|
|
|
Array.prototype[Symbol.iterator] = oldIterator;
|