mirror of https://github.com/tc39/test262.git
Temporal: Add test for Calendar.id with custom calendar
We already have a similar test covering TimeZone.id that ensures toString is not called. We did not have this coverage yet for Calendar.id, so adapt the TimeZone test for Calendar.
This commit is contained in:
parent
0fc42035eb
commit
39302ea3c1
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.calendar.prototype.id
|
||||
description: Getter does not call toString(), returns the ID from internal slot
|
||||
includes: [compareArray.js, temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const actual = [];
|
||||
const expected = [];
|
||||
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
TemporalHelpers.observeProperty(actual, calendar, Symbol.toPrimitive, undefined);
|
||||
TemporalHelpers.observeProperty(actual, calendar, "toString", function () {
|
||||
actual.push("call calendar.toString");
|
||||
return "calendar ID";
|
||||
});
|
||||
|
||||
const result = calendar.id;
|
||||
assert.compareArray(actual, expected);
|
||||
assert.sameValue(result, "iso8601");
|
Loading…
Reference in New Issue