summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Duration/subclass.js
blob: bc413760a310bafb522d2f0a0dad385c65fece53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.duration
description: Test for Temporal.Duration subclassing.
includes: [temporalHelpers.js]
features: [Temporal]
---*/

class CustomDuration extends Temporal.Duration {
}

const instance = new CustomDuration(1, 1, 0, 1);
TemporalHelpers.assertDuration(instance, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0);
assert.sameValue(Object.getPrototypeOf(instance), CustomDuration.prototype, "Instance of CustomDuration");
assert(instance instanceof CustomDuration, "Instance of CustomDuration");
assert(instance instanceof Temporal.Duration, "Instance of Temporal.Duration");

reportCompare(0, 0);