Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2020 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.now.plaintimeiso
7 description: PlainDateTime.toPlainTime is not observably called
8 includes: [compareArray.js]
9 features: [Temporal]
10 ---*/
11
12 const actual = [];
13 const expected = [];
14
15 Object.defineProperty(Temporal.PlainDateTime.prototype, "toPlainTime", {
16 get() {
17 actual.push("get Temporal.PlainDateTime.prototype.toPlainTime");
18 return function() {
19 actual.push("call Temporal.PlainDateTime.prototype.toPlainTime");
20 };
21 },
22 });
23
24 const result = Temporal.Now.plainTimeISO("UTC");
25 assert.sameValue(result instanceof Temporal.PlainTime, true);
26
27 assert.compareArray(actual, expected);
28
29 reportCompare(0, 0);