subclass.js (828B)
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.duration 7 description: Test for Temporal.Duration subclassing. 8 includes: [temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 class CustomDuration extends Temporal.Duration { 13 } 14 15 const instance = new CustomDuration(1, 1, 0, 1); 16 TemporalHelpers.assertDuration(instance, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0); 17 assert.sameValue(Object.getPrototypeOf(instance), CustomDuration.prototype, "Instance of CustomDuration"); 18 assert(instance instanceof CustomDuration, "Instance of CustomDuration"); 19 assert(instance instanceof Temporal.Duration, "Instance of Temporal.Duration"); 20 21 reportCompare(0, 0);