2023-03-03 02:40:57 +01:00
|
|
|
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-temporal.plainyearmonth.from
|
|
|
|
description: overflow property is extracted with string argument.
|
|
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
|
|
features: [Temporal]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
const expected = [
|
|
|
|
"get options.overflow",
|
|
|
|
"get options.overflow.toString",
|
|
|
|
"call options.overflow.toString",
|
|
|
|
];
|
|
|
|
|
|
|
|
let actual = [];
|
|
|
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
|
|
|
|
|
|
|
const result = Temporal.PlainYearMonth.from("2021-05", options);
|
|
|
|
assert.compareArray(actual, expected, "Successful call");
|
|
|
|
TemporalHelpers.assertPlainYearMonth(result, 2021, 5, "M05");
|
|
|
|
|
|
|
|
actual.splice(0); // empty it for the next check
|
|
|
|
const failureExpected = [
|
|
|
|
"get options.overflow",
|
2024-06-04 13:17:54 +02:00
|
|
|
"get options.overflow.toString",
|
|
|
|
"call options.overflow.toString",
|
2023-03-03 02:40:57 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
assert.throws(TypeError, () => Temporal.PlainYearMonth.from(7, options));
|
|
|
|
assert.compareArray(actual, failureExpected, "Failing call");
|