overflow-default-constrain.js (1193B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 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: By default, overflow = constrain 8 features: [Temporal] 9 includes: [temporalHelpers.js] 10 ---*/ 11 12 const date = {year: 2019, month: 1, day: 32}; 13 const data = [2019, 1, "M01", 31, 0, 0, 0, 0, 0, 0]; 14 15 TemporalHelpers.assertPlainDateTime( 16 Temporal.PlainDateTime.from(date), 17 ...data, 18 "by default, overflow is constrain (overflow options argument absent)" 19 ); 20 21 TemporalHelpers.assertPlainDateTime( 22 Temporal.PlainDateTime.from(date, {}), 23 ...data, 24 "by default, overflow is constrain (options argument is empty plain object)" 25 ); 26 27 TemporalHelpers.assertPlainDateTime( 28 Temporal.PlainDateTime.from(date, () => {}), 29 ...data, 30 "by default, overflow is constrain (options argument is empty function)" 31 ); 32 33 34 TemporalHelpers.assertPlainDateTime( 35 Temporal.PlainDateTime.from(date, {overflow: "constrain"}), 36 ...data, 37 "by default, overflow is constrain (overflow options argument present)" 38 ); 39 40 reportCompare(0, 0);