diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js new file mode 100644 index 0000000000..297b066c40 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/toJSON/returns-identifier-slot.js @@ -0,0 +1,26 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// 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"); + +reportCompare(0, 0); |