plaintime-propertybag-no-time-units.js (703B)
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.plaintime.compare 7 description: Missing time units in property bag default to 0 8 features: [Temporal] 9 ---*/ 10 11 const props = {}; 12 assert.throws(TypeError, () => Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30)), "TypeError if no properties are present"); 13 14 props.minute = 30; 15 const result = Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30)); 16 assert.sameValue(result, 0, "missing time units default to 0"); 17 18 reportCompare(0, 0);