relativeto-propertybag-invalid.js (895B)
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.duration.compare 7 description: Throws if a value in the relativeTo property bag is missing. 8 features: [Temporal] 9 ---*/ 10 11 const oneDay = new Temporal.Duration(0, 0, 0, 1); 12 const hours24 = new Temporal.Duration(0, 0, 0, 0, 24); 13 assert.throws(TypeError, () => Temporal.Duration.compare(oneDay, hours24, { relativeTo: { month: 11, day: 3 } }), "missing year"); 14 assert.throws(TypeError, () => Temporal.Duration.compare(oneDay, hours24, { relativeTo: { year: 2019, month: 11 } }), "missing day"); 15 assert.throws(TypeError, () => Temporal.Duration.compare(oneDay, hours24, { relativeTo: { year: 2019, day: 3 } }), "missing month"); 16 17 reportCompare(0, 0);