observable-get-overflow-argument-primitive.js (1258B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2023 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.plainyearmonth.from 7 description: overflow property is extracted with string argument. 8 includes: [compareArray.js, temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 const expected = [ 13 "get options.overflow", 14 "get options.overflow.toString", 15 "call options.overflow.toString", 16 ]; 17 18 let actual = []; 19 const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "reject" }, "options"); 20 21 const result = Temporal.PlainYearMonth.from("2021-05", options); 22 assert.compareArray(actual, expected, "Successful call"); 23 TemporalHelpers.assertPlainYearMonth(result, 2021, 5, "M05"); 24 25 actual.splice(0); // empty it for the next check 26 27 assert.throws(TypeError, () => Temporal.PlainYearMonth.from(7, options)); 28 assert.compareArray(actual, [], "Failing call before options is processed"); 29 30 actual.splice(0); 31 32 assert.throws(RangeError, () => Temporal.PlainYearMonth.from({ year: 2021, month: 13 }, options)); 33 assert.compareArray(actual, expected, "Failing call after options is processed"); 34 35 reportCompare(0, 0);