fields-plainmonthday.js (985B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2021 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.plainmonthday.from 7 description: Basic tests for PlainMonthDay.from(PlainMonthDay). 8 includes: [compareArray.js, temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 const expected = [ 13 "get overflow", 14 "get overflow.toString", 15 "call overflow.toString", 16 ]; 17 const actual = []; 18 const options = { 19 get overflow() { 20 actual.push("get overflow"); 21 return TemporalHelpers.toPrimitiveObserver(actual, "reject", "overflow"); 22 } 23 }; 24 25 const fields = new Temporal.PlainMonthDay(11, 16, undefined, 1960); 26 const result = Temporal.PlainMonthDay.from(fields, options); 27 TemporalHelpers.assertPlainMonthDay(result, "M11", 16, "should copy reference year", 1960); 28 assert.compareArray(actual, expected, "Should get overflow"); 29 30 reportCompare(0, 0);