argument-object.js (1360B)
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: Plain objects are acceptable 8 features: [Temporal] 9 includes: [temporalHelpers.js] 10 ---*/ 11 12 TemporalHelpers.assertPlainDateTime( 13 Temporal.PlainDateTime.from({year: 1976, month: 11, monthCode: "M11", day: 18}), 14 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, 15 "plain object with month & month code" 16 ); 17 18 assert.throws( 19 TypeError, 20 () => Temporal.PlainDateTime.from({}), 21 "empty object throws" 22 ); 23 24 TemporalHelpers.assertPlainDateTime( 25 Temporal.PlainDateTime.from({year: 1976, month: 11, day: 18, millisecond: 123}), 26 1976, 11, "M11", 18, 0, 0, 0, 123, 0, 0, 27 "plain object with month but not month code" 28 ); 29 30 TemporalHelpers.assertPlainDateTime( 31 Temporal.PlainDateTime.from({year: 1976, monthCode: "M09", day: 18, millisecond: 123}), 32 1976, 9, "M09", 18, 0, 0, 0, 123, 0, 0, 33 "plain object with month code but not month" 34 ); 35 36 37 TemporalHelpers.assertPlainDateTime( 38 Temporal.PlainDateTime.from({year: 1976, month: 11, day: 18, hours: 12}), 39 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, 40 "incorrectly-spelled properties (e.g., plural \"hours\") are ignored" 41 ); 42 43 reportCompare(0, 0);