observable-get-overflow-argument-primitive.js (1298B)
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.plaindatetime.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.PlainDateTime.from("2021-05-17T12:34:56", options); 22 assert.compareArray(actual, expected, "Successful call"); 23 TemporalHelpers.assertPlainDateTime(result, 2021, 5, "M05", 17, 12, 34, 56, 0, 0, 0); 24 25 actual.splice(0); // empty it for the next check 26 27 assert.throws(TypeError, () => Temporal.PlainDateTime.from(7, options)); 28 assert.compareArray(actual, [], "Failing call before options is processed"); 29 30 actual.splice(0); 31 32 assert.throws(RangeError, () => Temporal.PlainDateTime.from({ year: 2021, month: 2, day: 29 }, options)); 33 assert.compareArray(actual, expected, "Failing call after options is processed"); 34 35 reportCompare(0, 0);