mirror of https://github.com/tc39/test262.git
Change Temporal.Calendar.prototype.toJSON not to call toString
Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
This commit is contained in:
parent
aee3a937dc
commit
61d84cc6bc
23
test/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js
vendored
Normal file
23
test/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.tojson
|
||||
description: toJSON() returns the internal slot value
|
||||
includes: [compareArray.js, temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const actual = [];
|
||||
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
TemporalHelpers.observeProperty(actual, calendar, Symbol.toPrimitive, undefined);
|
||||
TemporalHelpers.observeProperty(actual, calendar, "id", "bogus");
|
||||
TemporalHelpers.observeProperty(actual, calendar, "toString", function () {
|
||||
actual.push("call calendar.toString");
|
||||
return "gregory";
|
||||
});
|
||||
|
||||
const result = calendar.toJSON();
|
||||
assert.sameValue(result, "iso8601", "toJSON gets the internal slot value");
|
||||
assert.compareArray(actual, [], "should not invoke any observable operations");
|
Loading…
Reference in New Issue