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