From a1bf99771ce623aabc8e8f93ad73cff54491d44c Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Feb 2023 12:28:55 -0800 Subject: [PATCH] Replace Temporal objects' .calendar getters with .calendarId/.getCalendar This is the replacement of the old API with the new API. Semantics will be corrected in the following commit. Normative PR: https://github.com/tc39/proposal-temporal/pull/2482 --- harness/temporalHelpers.js | 24 +++++++++----- .../Calendar/from/calendar-temporal-object.js | 2 +- .../dateFromFields/order-of-operations.js | 2 +- .../monthDayFromFields/order-of-operations.js | 2 +- .../order-of-operations.js | 2 +- ...-duration-relative-when-sign-mismatched.js | 2 +- .../calendar-case-insensitive.js | 2 +- .../toZonedDateTime/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../toZonedDateTime/calendar-string.js | 2 +- .../calendar-temporal-object.js | 2 +- .../plainDate/calendar-case-insensitive.js | 2 +- .../Temporal/Now/plainDate/calendar-number.js | 2 +- .../plainDate/calendar-string-leap-second.js | 4 +-- .../Temporal/Now/plainDate/calendar-string.js | 2 +- .../Now/plainDate/calendar-temporal-object.js | 2 +- .../Temporal/Now/plainDateISO/return-value.js | 2 +- .../calendar-case-insensitive.js | 2 +- .../Now/plainDateTime/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../Now/plainDateTime/calendar-string.js | 2 +- .../plainDateTime/calendar-temporal-object.js | 2 +- .../plainDateTimeISO/return-value-calendar.js | 3 +- .../calendar-case-insensitive.js | 2 +- .../Now/zonedDateTime/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../Now/zonedDateTime/calendar-string.js | 2 +- .../zonedDateTime/calendar-temporal-object.js | 4 +-- .../Now/zonedDateTimeISO/return-value.js | 3 +- test/built-ins/Temporal/PlainDate/basic.js | 6 ++-- .../PlainDate/calendar-case-insensitive.js | 2 +- .../Temporal/PlainDate/calendar-number.js | 2 +- .../Temporal/PlainDate/calendar-string.js | 2 +- .../PlainDate/calendar-temporal-object.js | 2 +- .../Temporal/PlainDate/calendar-undefined.js | 4 +-- .../PlainDate/from/argument-plaindate.js | 2 +- .../PlainDate/from/argument-plaindatetime.js | 2 +- .../from/argument-propertybag-calendar.js | 2 +- .../PlainDate/from/argument-zoneddatetime.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../PlainDate/prototype/calendar/branding.js | 22 ------------- .../prototype/calendarId/branding.js | 22 +++++++++++++ .../{calendar => calendarId}/prop-desc.js | 6 ++-- .../prototype/getCalendar/branding.js | 22 +++++++++++++ .../prototype/getCalendar/builtin.js | 33 +++++++++++++++++++ .../PlainDate/prototype/getCalendar/length.js | 25 ++++++++++++++ .../PlainDate/prototype/getCalendar/name.js | 23 +++++++++++++ .../getCalendar/not-a-constructor.js | 21 ++++++++++++ .../prototype/getCalendar/prop-desc.js | 21 ++++++++++++ .../prototype/getISOFields/field-names.js | 2 +- .../prototype/toPlainDateTime/custom.js | 2 +- .../prototype/toPlainMonthDay/basic.js | 2 +- .../prototype/toPlainYearMonth/basic.js | 2 +- .../prototype/toZonedDateTime/calendar.js | 2 +- .../timezone-getpossibleinstantsfor.js | 4 +-- .../PlainDate/prototype/withCalendar/basic.js | 8 ++--- .../withCalendar/calendar-case-insensitive.js | 2 +- .../prototype/withCalendar/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 2 +- .../withCalendar/subclassing-ignored.js | 2 +- .../calendar-case-insensitive.js | 2 +- .../Temporal/PlainDateTime/calendar-number.js | 2 +- .../Temporal/PlainDateTime/calendar-string.js | 2 +- .../PlainDateTime/calendar-temporal-object.js | 2 +- .../PlainDateTime/calendar-undefined.js | 4 +-- .../PlainDateTime/constructor-full.js | 2 +- .../PlainDateTime/from/argument-plaindate.js | 2 +- .../from/argument-plaindatetime.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../prototype/calendar/branding.js | 22 ------------- .../prototype/calendarId/branding.js | 22 +++++++++++++ .../prototype/calendarId}/prop-desc.js | 6 ++-- .../prototype/getCalendar/branding.js | 22 +++++++++++++ .../prototype/getCalendar/builtin.js | 33 +++++++++++++++++++ .../prototype/getCalendar/length.js | 25 ++++++++++++++ .../prototype/getCalendar/name.js | 23 +++++++++++++ .../getCalendar/not-a-constructor.js | 21 ++++++++++++ .../prototype/getCalendar/prop-desc.js | 21 ++++++++++++ .../prototype/getISOFields/field-names.js | 2 +- ...ateuntil-called-with-plaindate-calendar.js | 4 +-- .../prototype/toZonedDateTime/basic.js | 2 +- .../toZonedDateTime/plain-custom-timezone.js | 4 +-- ...ateuntil-called-with-plaindate-calendar.js | 4 +-- .../prototype/withCalendar/basic.js | 2 +- .../withCalendar/calendar-case-insensitive.js | 2 +- .../prototype/withCalendar/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 2 +- .../withCalendar/subclassing-ignored.js | 2 +- .../argument-plaindate-calendar-noniso.js | 4 +-- .../argument-plaindate-calendar-same-id.js | 2 +- ...argument-plaindate-calendar-same-object.js | 2 +- .../argument-plaindate-calendar.js | 4 +-- .../argument-string-iso-calendar.js | 2 +- .../withPlainDate/calendar-temporal-object.js | 2 +- .../built-ins/Temporal/PlainMonthDay/basic.js | 6 ++-- .../calendar-case-insensitive.js | 2 +- .../Temporal/PlainMonthDay/calendar-number.js | 2 +- .../Temporal/PlainMonthDay/calendar-string.js | 2 +- .../PlainMonthDay/calendar-temporal-object.js | 2 +- .../PlainMonthDay/calendar-undefined.js | 4 +-- .../from/argument-plainmonthday.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../PlainMonthDay/from/fields-object.js | 2 +- .../PlainMonthDay/from/fields-string.js | 2 +- .../prototype/calendar/branding.js | 22 ------------- .../prototype/calendarId/branding.js | 22 +++++++++++++ .../{calendar => calendarId}/prop-desc.js | 6 ++-- .../prototype/getCalendar/branding.js | 22 +++++++++++++ .../prototype/getCalendar/builtin.js | 33 +++++++++++++++++++ .../prototype/getCalendar/length.js | 25 ++++++++++++++ .../prototype/getCalendar/name.js | 23 +++++++++++++ .../getCalendar/not-a-constructor.js | 21 ++++++++++++ .../prototype/getCalendar/prop-desc.js | 21 ++++++++++++ .../prototype/getISOFields/field-names.js | 2 +- .../calendar-temporal-object.js | 2 +- .../calendar-temporal-object.js | 2 +- .../calendar-case-insensitive.js | 2 +- .../PlainYearMonth/calendar-number.js | 2 +- .../PlainYearMonth/calendar-string.js | 2 +- .../calendar-temporal-object.js | 2 +- .../PlainYearMonth/calendar-undefined.js | 4 +-- .../PlainYearMonth/from/argument-plaindate.js | 2 +- .../from/argument-plainyearmonth.js | 2 +- .../PlainYearMonth/from/argument-string.js | 4 +-- .../from/calendar-temporal-object.js | 2 +- .../prototype/calendar/branding.js | 22 ------------- .../prototype/calendarId/branding.js | 22 +++++++++++++ .../prototype/calendarId}/prop-desc.js | 6 ++-- .../prototype/getCalendar/branding.js | 22 +++++++++++++ .../prototype/getCalendar/builtin.js | 33 +++++++++++++++++++ .../prototype/getCalendar/length.js | 25 ++++++++++++++ .../prototype/getCalendar/name.js | 23 +++++++++++++ .../getCalendar/not-a-constructor.js | 21 ++++++++++++ .../prototype/getCalendar/prop-desc.js | 21 ++++++++++++ .../prototype/getISOFields/field-names.js | 2 +- .../calendar-case-insensitive.js | 2 +- .../getPlainDateTimeFor/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../getPlainDateTimeFor/calendar-string.js | 2 +- .../calendar-temporal-object.js | 2 +- .../getPlainDateTimeFor/calendar-undefined.js | 4 +-- .../calendar-case-insensitive.js | 2 +- .../Temporal/ZonedDateTime/calendar-number.js | 2 +- .../Temporal/ZonedDateTime/calendar-string.js | 2 +- .../ZonedDateTime/calendar-temporal-object.js | 2 +- .../ZonedDateTime/calendar-undefined.js | 4 +-- ...t-propertybag-calendar-case-insensitive.js | 4 +-- ...gument-propertybag-calendar-leap-second.js | 4 +-- .../argument-propertybag-calendar-number.js | 4 +-- .../argument-propertybag-calendar-string.js | 2 +- .../argument-string-calendar-annotation.js | 6 +--- .../from/argument-zoneddatetime.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../prototype/calendar/branding.js | 22 ------------- .../prototype/calendarId/branding.js | 22 +++++++++++++ .../{calendar => calendarId}/prop-desc.js | 6 ++-- .../prototype/getCalendar/branding.js | 22 +++++++++++++ .../prototype/getCalendar/builtin.js | 33 +++++++++++++++++++ .../prototype/getCalendar/length.js | 25 ++++++++++++++ .../prototype/getCalendar/name.js | 23 +++++++++++++ .../getCalendar/not-a-constructor.js | 21 ++++++++++++ .../prototype/getCalendar/prop-desc.js | 21 ++++++++++++ .../prototype/getISOFields/field-names.js | 2 +- .../withCalendar/calendar-case-insensitive.js | 2 +- .../prototype/withCalendar/calendar-number.js | 2 +- .../calendar-string-leap-second.js | 4 +-- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 2 +- .../withCalendar/subclassing-ignored.js | 2 +- .../withPlainDate/calendar-temporal-object.js | 2 +- .../dateFromFields/order-of-operations.js | 2 +- .../monthDayFromFields/order-of-operations.js | 2 +- .../order-of-operations.js | 2 +- .../Temporal/Now/plainDate/calendar-string.js | 2 +- .../Now/plainDateTime/calendar-string.js | 2 +- .../Now/zonedDateTime/calendar-string.js | 4 +-- .../zonedDateTime/calendar-timezone-string.js | 3 +- .../Now/zonedDateTimeISO/timezone-string.js | 3 +- .../argument-plaindate-calendar-noniso.js | 4 +-- .../argument-plaindate-calendar-same-id.js | 2 +- ...argument-plaindate-calendar-same-object.js | 2 +- .../argument-plaindate-calendar.js | 4 +-- .../withPlainDate/argument-string-calendar.js | 4 +-- .../argument-string-iso-calendar.js | 2 +- .../withCalendar/calendar-case-insensitive.js | 2 +- test/staging/Temporal/Regex/old/plaindate.js | 2 +- .../Temporal/Regex/old/plaindatetime.js | 4 +-- .../Temporal/Regex/old/plainmonthday.js | 2 +- .../Temporal/Regex/old/plainyearmonth.js | 2 +- .../UserCalendar/old/calendar-extra-fields.js | 2 +- .../old/calendar-non-trivial-mergefields.js | 4 +-- .../old/trivial-protocol-implementation.js | 6 ++-- .../UserCalendar/old/trivial-subclass.js | 6 ++-- .../Temporal/ZonedDateTime/old/toPlainDate.js | 2 +- .../ZonedDateTime/old/toPlainMonthDay.js | 2 +- .../ZonedDateTime/old/toPlainYearMonth.js | 2 +- .../ZonedDateTime/old/withCalendar.js | 2 +- .../ZonedDateTime/old/withTimezone.js | 2 +- 202 files changed, 1063 insertions(+), 340 deletions(-) delete mode 100644 test/built-ins/Temporal/PlainDate/prototype/calendar/branding.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/calendarId/branding.js rename test/built-ins/Temporal/PlainDate/prototype/{calendar => calendarId}/prop-desc.js (72%) create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/branding.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/builtin.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/length.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/name.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/not-a-constructor.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getCalendar/prop-desc.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/calendar/branding.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/calendarId/branding.js rename test/built-ins/Temporal/{PlainYearMonth/prototype/calendar => PlainDateTime/prototype/calendarId}/prop-desc.js (71%) create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/branding.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/builtin.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/length.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/name.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/not-a-constructor.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/prop-desc.js delete mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/calendar/branding.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/branding.js rename test/built-ins/Temporal/PlainMonthDay/prototype/{calendar => calendarId}/prop-desc.js (71%) create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/branding.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/builtin.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/length.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/name.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/not-a-constructor.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/prop-desc.js delete mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/calendar/branding.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/branding.js rename test/built-ins/Temporal/{PlainDateTime/prototype/calendar => PlainYearMonth/prototype/calendarId}/prop-desc.js (70%) create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/branding.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/builtin.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/length.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/name.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/not-a-constructor.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/prop-desc.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/calendar/branding.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/branding.js rename test/built-ins/Temporal/ZonedDateTime/prototype/{calendar => calendarId}/prop-desc.js (71%) create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/branding.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/builtin.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/length.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/name.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/not-a-constructor.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/prop-desc.js diff --git a/harness/temporalHelpers.js b/harness/temporalHelpers.js index 41273ee046..a8cfaea2cb 100644 --- a/harness/temporalHelpers.js +++ b/harness/temporalHelpers.js @@ -76,7 +76,7 @@ var TemporalHelpers = { * Shorthand for asserting that each field of a Temporal.PlainDate is equal to * an expected value. (Except the `calendar` property, since callers may want * to assert either object equality with an object they put in there, or the - * result of date.calendar.toString().) + * value of date.calendarId.) */ assertPlainDate(date, year, month, monthCode, day, description = "", era = undefined, eraYear = undefined) { assert(date instanceof Temporal.PlainDate, `${description} instanceof`); @@ -94,7 +94,7 @@ var TemporalHelpers = { * Shorthand for asserting that each field of a Temporal.PlainDateTime is * equal to an expected value. (Except the `calendar` property, since callers * may want to assert either object equality with an object they put in there, - * or the result of datetime.calendar.toString().) + * or the value of datetime.calendarId.) */ assertPlainDateTime(datetime, year, month, monthCode, day, hour, minute, second, millisecond, microsecond, nanosecond, description = "", era = undefined, eraYear = undefined) { assert(datetime instanceof Temporal.PlainDateTime, `${description} instanceof`); @@ -117,13 +117,17 @@ var TemporalHelpers = { * * Shorthand for asserting that two Temporal.PlainDateTimes are of the correct * type, equal according to their equals() methods, and additionally that - * their calendars are the same value. + * their calendar internal slots are the same value. */ assertPlainDateTimesEqual(actual, expected, description = "") { assert(expected instanceof Temporal.PlainDateTime, `${description} expected value should be a Temporal.PlainDateTime`); assert(actual instanceof Temporal.PlainDateTime, `${description} instanceof`); assert(actual.equals(expected), `${description} equals method`); - assert.sameValue(actual.calendar, expected.calendar, `${description} calendar same value`); + assert.sameValue( + actual.getISOFields().calendar, + expected.getISOFields().calendar, + `${description} calendar same value` + ); }, /* @@ -132,7 +136,7 @@ var TemporalHelpers = { * Shorthand for asserting that each field of a Temporal.PlainMonthDay is * equal to an expected value. (Except the `calendar` property, since callers * may want to assert either object equality with an object they put in there, - * or the result of monthDay.calendar.toString().) + * or the value of monthDay.calendarId().) */ assertPlainMonthDay(monthDay, monthCode, day, description = "", referenceISOYear = 1972) { assert(monthDay instanceof Temporal.PlainMonthDay, `${description} instanceof`); @@ -175,7 +179,7 @@ var TemporalHelpers = { * Shorthand for asserting that each field of a Temporal.PlainYearMonth is * equal to an expected value. (Except the `calendar` property, since callers * may want to assert either object equality with an object they put in there, - * or the result of yearMonth.calendar.toString().) + * or the value of yearMonth.calendarId.) */ assertPlainYearMonth(yearMonth, year, month, monthCode, description = "", era = undefined, eraYear = undefined, referenceISODay = 1) { assert(yearMonth instanceof Temporal.PlainYearMonth, `${description} instanceof`); @@ -192,14 +196,18 @@ var TemporalHelpers = { * * Shorthand for asserting that two Temporal.ZonedDateTimes are of the correct * type, equal according to their equals() methods, and additionally that - * their time zones and calendars are the same value. + * their time zones and calendar internal slots are the same value. */ assertZonedDateTimesEqual(actual, expected, description = "") { assert(expected instanceof Temporal.ZonedDateTime, `${description} expected value should be a Temporal.ZonedDateTime`); assert(actual instanceof Temporal.ZonedDateTime, `${description} instanceof`); assert(actual.equals(expected), `${description} equals method`); assert.sameValue(actual.timeZone, expected.timeZone, `${description} time zone same value`); - assert.sameValue(actual.calendar, expected.calendar, `${description} calendar same value`); + assert.sameValue( + actual.getISOFields().calendar, + expected.getISOFields().calendar, + `${description} calendar same value` + ); }, /* diff --git a/test/built-ins/Temporal/Calendar/from/calendar-temporal-object.js b/test/built-ins/Temporal/Calendar/from/calendar-temporal-object.js index 7d2f9a34af..10c09d3c48 100644 --- a/test/built-ins/Temporal/Calendar/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/Calendar/from/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = Temporal.Calendar.from(arg); - assert.sameValue(result, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.id, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js index 60b0540938..e28b27c281 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js @@ -42,5 +42,5 @@ const options = TemporalHelpers.propertyBagObserver(actual, { const result = instance.dateFromFields(fields, options); TemporalHelpers.assertPlainDate(result, 1, 1, "M01", 1, "date result"); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js index 427f046130..cc61cedf60 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js @@ -42,5 +42,5 @@ const options = TemporalHelpers.propertyBagObserver(actual, { const result = instance.monthDayFromFields(fields, options); TemporalHelpers.assertPlainMonthDay(result, "M01", 1, "monthDay result"); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js index cd10b2797d..49a2149551 100644 --- a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js +++ b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js @@ -38,5 +38,5 @@ const options = TemporalHelpers.propertyBagObserver(actual, { const result = instance.yearMonthFromFields(fields, options); TemporalHelpers.assertPlainYearMonth(result, 1, 1, "M01", "yearMonth result"); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/built-ins/Temporal/Duration/prototype/round/throws-in-unbalance-duration-relative-when-sign-mismatched.js b/test/built-ins/Temporal/Duration/prototype/round/throws-in-unbalance-duration-relative-when-sign-mismatched.js index 2cac32ec24..492d89a7ee 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/throws-in-unbalance-duration-relative-when-sign-mismatched.js +++ b/test/built-ins/Temporal/Duration/prototype/round/throws-in-unbalance-duration-relative-when-sign-mismatched.js @@ -22,7 +22,7 @@ var cal = new class extends Temporal.Calendar { }("iso8601"); var relativeTo = new Temporal.PlainDateTime(1970, 1, 1, 0, 0, 0, 0, 0, 0, cal); -assert.sameValue(relativeTo.calendar, cal); +assert.sameValue(relativeTo.getCalendar(), cal); var options = { smallestUnit: "days", diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-case-insensitive.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-case-insensitive.js index ed23625dab..8b67bb6909 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const arg = "iSo8601"; const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-number.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-number.js index b66e68c75c..21a496debe 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-number.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-number.js @@ -12,7 +12,7 @@ const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const arg = 19761118; const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string-leap-second.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string-leap-second.js index 7264f33377..65c4f30a89 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string-leap-second.js @@ -12,7 +12,7 @@ const instance = new Temporal.Instant(1_000_000_000_000_000_000n); let arg = "2016-12-31T23:59:60"; const result1 = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -20,7 +20,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js index 6984994a46..97ce4abd3b 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const arg = "iso8601"; const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-temporal-object.js index ded76ba195..f43ba3ba35 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-temporal-object.js @@ -33,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-case-insensitive.js b/test/built-ins/Temporal/Now/plainDate/calendar-case-insensitive.js index 2654459f22..aaefeff6cc 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = Temporal.Now.plainDate(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-number.js b/test/built-ins/Temporal/Now/plainDate/calendar-number.js index 8586672bdd..a82a0f8c07 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-number.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = Temporal.Now.plainDate(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-string-leap-second.js b/test/built-ins/Temporal/Now/plainDate/calendar-string-leap-second.js index 25c6a9bd3b..dbf0dce013 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-string-leap-second.js @@ -10,7 +10,7 @@ features: [Temporal] let arg = "2016-12-31T23:59:60"; const result1 = Temporal.Now.plainDate(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -18,7 +18,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = Temporal.Now.plainDate(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-string.js b/test/built-ins/Temporal/Now/plainDate/calendar-string.js index 5e411bfd35..e6d247a547 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-string.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = Temporal.Now.plainDate(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-temporal-object.js b/test/built-ins/Temporal/Now/plainDate/calendar-temporal-object.js index 7e52007371..c116e5e332 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-temporal-object.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = Temporal.Now.plainDate(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/Now/plainDateISO/return-value.js b/test/built-ins/Temporal/Now/plainDateISO/return-value.js index 705a410fbb..511e51f769 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/return-value.js +++ b/test/built-ins/Temporal/Now/plainDateISO/return-value.js @@ -9,4 +9,4 @@ features: [Temporal] const d = Temporal.Now.plainDateISO(); assert(d instanceof Temporal.PlainDate); -assert.sameValue(d.calendar.id, "iso8601"); +assert.sameValue(d.getISOFields().calendar, "iso8601", "calendar slot should store a string"); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-case-insensitive.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-case-insensitive.js index 18c553fd6c..93e5a8f197 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = Temporal.Now.plainDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-number.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-number.js index 5d226c703e..57d2e79672 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-number.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = Temporal.Now.plainDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-string-leap-second.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-string-leap-second.js index 98af04f808..743ba541a7 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-string-leap-second.js @@ -10,7 +10,7 @@ features: [Temporal] let arg = "2016-12-31T23:59:60"; const result1 = Temporal.Now.plainDateTime(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -18,7 +18,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = Temporal.Now.plainDateTime(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js index 4a43867f52..964c8148cd 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = Temporal.Now.plainDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js index 24d92873a0..54ee450dcc 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = Temporal.Now.plainDateTime(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js b/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js index 0a666629e8..073856d8ee 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js @@ -8,5 +8,4 @@ features: [Temporal] ---*/ const result = Temporal.Now.plainDateTimeISO(); -assert(result.calendar instanceof Temporal.Calendar); -assert.sameValue(result.calendar.id, "iso8601"); +assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string"); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-case-insensitive.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-case-insensitive.js index 1222f7175f..9b6bbb3156 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = Temporal.Now.zonedDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-number.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-number.js index 296ed87aa0..6a6578db32 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-number.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = Temporal.Now.zonedDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-string-leap-second.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string-leap-second.js index dde4ad71fe..5209e35187 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string-leap-second.js @@ -10,7 +10,7 @@ features: [Temporal] let arg = "2016-12-31T23:59:60"; const result1 = Temporal.Now.zonedDateTime(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -18,7 +18,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = Temporal.Now.zonedDateTime(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js index 52c9084a23..2bec05fd3f 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = Temporal.Now.zonedDateTime(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-temporal-object.js index 5667165e28..f2d262cf27 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-temporal-object.js @@ -6,7 +6,7 @@ esid: sec-temporal.now.zoneddatetime description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots info: | sec-temporal-totemporalcalendar step 1.b: - b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then + b. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then i. Return _temporalCalendarLike_.[[Calendar]]. includes: [compareArray.js] features: [Temporal] @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = Temporal.Now.zonedDateTime(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js index 26ce97d976..7c5b39a660 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js @@ -10,7 +10,6 @@ features: [Temporal] const zdt = Temporal.Now.zonedDateTimeISO(); const tz = Temporal.Now.timeZoneId(); assert(zdt instanceof Temporal.ZonedDateTime); -assert(zdt.calendar instanceof Temporal.Calendar); -assert.sameValue(zdt.calendar.id, "iso8601"); +assert.sameValue(zdt.getISOFields().calendar, "iso8601", "calendar slot should store a string"); assert(zdt.timeZone instanceof Temporal.TimeZone); assert.sameValue(zdt.timeZone.id, tz); diff --git a/test/built-ins/Temporal/PlainDate/basic.js b/test/built-ins/Temporal/PlainDate/basic.js index 11d5b4ae78..36f65021b6 100644 --- a/test/built-ins/Temporal/PlainDate/basic.js +++ b/test/built-ins/Temporal/PlainDate/basic.js @@ -17,9 +17,9 @@ Object.defineProperty(Temporal.Calendar, "from", { const calendar = new Temporal.Calendar("iso8601"); const plainDateWithObject = new Temporal.PlainDate(2020, 12, 24, calendar); TemporalHelpers.assertPlainDate(plainDateWithObject, 2020, 12, "M12", 24, "with object"); -assert.sameValue(plainDateWithObject.calendar, calendar); +assert.sameValue(plainDateWithObject.getCalendar(), calendar); const plainDateWithString = new Temporal.PlainDate(2020, 12, 24, "iso8601"); TemporalHelpers.assertPlainDate(plainDateWithString, 2020, 12, "M12", 24, "with string"); -assert.sameValue(plainDateWithString.calendar.toString(), "iso8601"); -assert.notSameValue(plainDateWithString.calendar, calendar); +assert.sameValue(plainDateWithString.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.notSameValue(plainDateWithString.getCalendar(), calendar); diff --git a/test/built-ins/Temporal/PlainDate/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDate/calendar-case-insensitive.js index d0265180c9..ab5ef646fd 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDate/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = new Temporal.PlainDate(2000, 5, 2, arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainDate/calendar-number.js b/test/built-ins/Temporal/PlainDate/calendar-number.js index 8fdba70164..be222b1c4c 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-number.js +++ b/test/built-ins/Temporal/PlainDate/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = new Temporal.PlainDate(2000, 5, 2, arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainDate/calendar-string.js b/test/built-ins/Temporal/PlainDate/calendar-string.js index 252f3ae145..228b6e9489 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainDate(2000, 5, 2, arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDate/calendar-temporal-object.js index 108a8aae55..57d527fb38 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDate/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = new Temporal.PlainDate(2000, 5, 2, arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainDate/calendar-undefined.js b/test/built-ins/Temporal/PlainDate/calendar-undefined.js index 945fc0dd12..bd0f7e5dd6 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-undefined.js +++ b/test/built-ins/Temporal/PlainDate/calendar-undefined.js @@ -16,7 +16,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const dateExplicit = new Temporal.PlainDate(...args, undefined); -assert.sameValue(dateExplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateExplicit.getISOFields().calendar, "iso8601", "calendar slot should store string"); const dateImplicit = new Temporal.PlainDate(...args); -assert.sameValue(dateImplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateImplicit.getISOFields().calendar, "iso8601", "calendar slot should store string"); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js b/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js index 876d64eb2b..e0ac9111e0 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js @@ -17,7 +17,7 @@ TemporalHelpers.assertPlainDate( "PlainDate is copied" ); -assert.sameValue(result.calendar, orig.calendar, "Calendar is copied"); +assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js b/test/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js index b8b4b0fac3..498037c245 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js @@ -17,5 +17,5 @@ features: [Temporal] TemporalHelpers.checkPlainDateTimeConversionFastPath((datetime, calendar) => { const result = Temporal.PlainDate.from(datetime); TemporalHelpers.assertPlainDate(result, 2000, 5, "M05", 2); - assert.sameValue(result.calendar, calendar, "calendar result"); + assert.sameValue(result.getCalendar(), calendar, "calendar result"); }); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js index 8747c7ecc7..c1b6eb5de3 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js @@ -11,4 +11,4 @@ features: [Temporal] const calendar = new Temporal.Calendar("iso8601"); const plainDate = Temporal.PlainDate.from({ year: 1976, month: 11, day: 18, calendar }); TemporalHelpers.assertPlainDate(plainDate, 1976, 11, "M11", 18); -assert.sameValue(plainDate.calendar, calendar); +assert.sameValue(plainDate.getISOFields().calendar, "iso8601", "calendar slot should store a string"); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js b/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js index 133ea14f89..6288a5e782 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js @@ -19,7 +19,7 @@ TemporalHelpers.assertPlainDate( ); assert.sameValue( - result.calendar, + result.getCalendar(), calendar, "Calendar is copied" ); diff --git a/test/built-ins/Temporal/PlainDate/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDate/from/calendar-temporal-object.js index 47a5080614..8960848b0c 100644 --- a/test/built-ins/Temporal/PlainDate/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDate/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const result = Temporal.PlainDate.from({ year: 2000, month: 5, day: 2, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/calendar/branding.js b/test/built-ins/Temporal/PlainDate/prototype/calendar/branding.js deleted file mode 100644 index fc28805d6a..0000000000 --- a/test/built-ins/Temporal/PlainDate/prototype/calendar/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-temporal.plaindate.prototype.calendar -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const calendar = Object.getOwnPropertyDescriptor(Temporal.PlainDate.prototype, "calendar").get; - -assert.sameValue(typeof calendar, "function"); - -assert.throws(TypeError, () => calendar.call(undefined), "undefined"); -assert.throws(TypeError, () => calendar.call(null), "null"); -assert.throws(TypeError, () => calendar.call(true), "true"); -assert.throws(TypeError, () => calendar.call(""), "empty string"); -assert.throws(TypeError, () => calendar.call(Symbol()), "symbol"); -assert.throws(TypeError, () => calendar.call(1), "1"); -assert.throws(TypeError, () => calendar.call({}), "plain object"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainDate), "Temporal.PlainDate"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainDate.prototype), "Temporal.PlainDate.prototype"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/calendarId/branding.js b/test/built-ins/Temporal/PlainDate/prototype/calendarId/branding.js new file mode 100644 index 0000000000..5a63691e87 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/calendarId/branding.js @@ -0,0 +1,22 @@ +// 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.plaindate.prototype.calendarid +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const calendarId = Object.getOwnPropertyDescriptor(Temporal.PlainDate.prototype, "calendarId").get; + +assert.sameValue(typeof calendarId, "function"); + +assert.throws(TypeError, () => calendarId.call(undefined), "undefined"); +assert.throws(TypeError, () => calendarId.call(null), "null"); +assert.throws(TypeError, () => calendarId.call(true), "true"); +assert.throws(TypeError, () => calendarId.call(""), "empty string"); +assert.throws(TypeError, () => calendarId.call(Symbol()), "symbol"); +assert.throws(TypeError, () => calendarId.call(1), "1"); +assert.throws(TypeError, () => calendarId.call({}), "plain object"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainDate), "Temporal.PlainDate"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainDate.prototype), "Temporal.PlainDate.prototype"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/calendar/prop-desc.js b/test/built-ins/Temporal/PlainDate/prototype/calendarId/prop-desc.js similarity index 72% rename from test/built-ins/Temporal/PlainDate/prototype/calendar/prop-desc.js rename to test/built-ins/Temporal/PlainDate/prototype/calendarId/prop-desc.js index 6a40d4aa3c..212f06407d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/calendar/prop-desc.js +++ b/test/built-ins/Temporal/PlainDate/prototype/calendarId/prop-desc.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-get-temporal.plaindate.prototype.calendar -description: The "calendar" property of Temporal.PlainDate.prototype +esid: sec-get-temporal.plaindate.prototype.calendarid +description: The "calendarId" property of Temporal.PlainDate.prototype features: [Temporal] ---*/ -const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainDate.prototype, "calendar"); +const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainDate.prototype, "calendarId"); assert.sameValue(typeof descriptor.get, "function"); assert.sameValue(descriptor.set, undefined); assert.sameValue(descriptor.enumerable, false); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/branding.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/branding.js new file mode 100644 index 0000000000..c2b346989f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/branding.js @@ -0,0 +1,22 @@ +// 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.plaindate.prototype.getcalendar +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getCalendar = Temporal.PlainDate.prototype.getCalendar; + +assert.sameValue(typeof getCalendar, "function"); + +assert.throws(TypeError, () => getCalendar.call(undefined), "undefined"); +assert.throws(TypeError, () => getCalendar.call(null), "null"); +assert.throws(TypeError, () => getCalendar.call(true), "true"); +assert.throws(TypeError, () => getCalendar.call(""), "empty string"); +assert.throws(TypeError, () => getCalendar.call(Symbol()), "symbol"); +assert.throws(TypeError, () => getCalendar.call(1), "1"); +assert.throws(TypeError, () => getCalendar.call({}), "plain object"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainDate), "Temporal.PlainDate"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainDate.prototype), "Temporal.PlainDate.prototype"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/builtin.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/builtin.js new file mode 100644 index 0000000000..08474bc031 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/builtin.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.getcalendar +description: > + Tests that Temporal.PlainDate.prototype.getCalendar + meets the requirements for built-in objects defined by the + introduction of chapter 17 of the ECMAScript Language Specification. +info: | + Built-in functions that are not constructors do not have a "prototype" property unless + otherwise specified in the description of a particular function. + + Unless specified otherwise, a built-in object that is callable as a function is a built-in + function object with the characteristics described in 10.3. Unless specified otherwise, the + [[Extensible]] internal slot of a built-in object initially has the value true. + + Unless otherwise specified every built-in function and every built-in constructor has the + Function prototype object [...] as the value of its [[Prototype]] internal slot. +features: [Temporal] +---*/ + +assert.sameValue(Object.isExtensible(Temporal.PlainDate.prototype.getCalendar), + true, "Built-in objects must be extensible."); + +assert.sameValue(Object.prototype.toString.call(Temporal.PlainDate.prototype.getCalendar), + "[object Function]", "Object.prototype.toString"); + +assert.sameValue(Object.getPrototypeOf(Temporal.PlainDate.prototype.getCalendar), + Function.prototype, "prototype"); + +assert.sameValue(Temporal.PlainDate.prototype.getCalendar.hasOwnProperty("prototype"), + false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/length.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/length.js new file mode 100644 index 0000000000..70b9d9017f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/length.js @@ -0,0 +1,25 @@ +// 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.plaindate.prototype.getcalendar +description: Temporal.PlainDate.prototype.getCalendar.length is 0 +info: | + Every built-in function object, including constructors, has a "length" property whose value is + an integer. Unless otherwise specified, this value is equal to the largest number of named + arguments shown in the subclause headings for the function description. Optional parameters + (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form + «...name») are not included in the default argument count. + + Unless otherwise specified, the "length" property of a built-in function object has the + attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainDate.prototype.getCalendar, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/name.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/name.js new file mode 100644 index 0000000000..91189d8e6c --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.getcalendar +description: Temporal.PlainDate.prototype.getCalendar.name is "getCalendar". +info: | + Every built-in function object, including constructors, that is not identified as an anonymous + function has a "name" property whose value is a String. Unless otherwise specified, this value + is the name that is given to the function in this specification. + + Unless otherwise specified, the "name" property of a built-in function object, if it exists, + has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainDate.prototype.getCalendar, "name", { + value: "getCalendar", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/not-a-constructor.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/not-a-constructor.js new file mode 100644 index 0000000000..12675be195 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/not-a-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.getcalendar +description: > + Temporal.PlainDate.prototype.getCalendar does not implement [[Construct]], is not new-able +info: | + Built-in function objects that are not identified as constructors do not implement the + [[Construct]] internal method unless otherwise specified in the description of a particular + function. +includes: [isConstructor.js] +features: [Reflect.construct, Temporal] +---*/ + +assert.throws(TypeError, () => { + new Temporal.PlainDate.prototype.getCalendar(); +}, "Calling as constructor"); + +assert.sameValue(isConstructor(Temporal.PlainDate.prototype.getCalendar), false, + "isConstructor(Temporal.PlainDate.prototype.getCalendar)"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getCalendar/prop-desc.js b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/prop-desc.js new file mode 100644 index 0000000000..1932c08e2f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getCalendar/prop-desc.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.getcalendar +description: The "getCalendar" property of Temporal.PlainDate.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.PlainDate.prototype.getCalendar, + "function", + "`typeof PlainDate.prototype.getCalendar` is `function`" +); + +verifyProperty(Temporal.PlainDate.prototype, "getCalendar", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getISOFields/field-names.js b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/field-names.js index 1b8e5a9444..405459ab06 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/getISOFields/field-names.js +++ b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/field-names.js @@ -13,4 +13,4 @@ const result = date.getISOFields(); assert.sameValue(result.isoYear, 2000, "isoYear result"); assert.sameValue(result.isoMonth, 5, "isoMonth result"); assert.sameValue(result.isoDay, 2, "isoDay result"); -assert.sameValue(result.calendar.id, "iso8601", "calendar result"); +assert.sameValue(result.calendar, "iso8601", "calendar result"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/custom.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/custom.js index ead40f974c..66a3208dd2 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/custom.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/custom.js @@ -11,4 +11,4 @@ features: [Temporal] const calendar = TemporalHelpers.calendarThrowEverything(); const plainDate = new Temporal.PlainDate(2000, 5, 2, calendar); const result = plainDate.toPlainDateTime("11:30:23"); -assert.sameValue(result.calendar, calendar, "calendar"); +assert.sameValue(result.getCalendar(), calendar, "calendar"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js index 1c00017840..c64b637bc3 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js @@ -12,4 +12,4 @@ const calendar = new Temporal.Calendar("iso8601"); const pd = new Temporal.PlainDate(1970, 12, 24, calendar); const pmd = pd.toPlainMonthDay(); TemporalHelpers.assertPlainMonthDay(pmd, "M12", 24); -assert.sameValue(pmd.calendar, calendar); +assert.sameValue(pmd.getISOFields().calendar, "iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js index 1a8bb523fb..d2c722c514 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js @@ -12,4 +12,4 @@ const calendar = new Temporal.Calendar("iso8601"); const pd = new Temporal.PlainDate(1970, 12, 24, calendar); const pym = pd.toPlainYearMonth(); TemporalHelpers.assertPlainYearMonth(pym, 1970, 12, "M12"); -assert.sameValue(pym.calendar, calendar); +assert.sameValue(pym.getISOFields().calendar, "iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar.js index dea05bec6d..a864baa1ae 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar.js @@ -16,4 +16,4 @@ const result = plainDate.toZonedDateTime({ }); assert.sameValue(result.epochNanoseconds, 957270600_000_000_000n); assert.sameValue(result.timeZone.toString(), "UTC"); -assert.sameValue(result.calendar, calendar); +assert.sameValue(result.getCalendar(), calendar); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor.js index 4431024715..fb13499e76 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor.js @@ -13,7 +13,7 @@ class CustomTimeZone extends Temporal.TimeZone { super("UTC"); } getPossibleInstantsFor(plainDateTime) { - assert.sameValue(plainDateTime.calendar, calendar); + assert.sameValue(plainDateTime.getCalendar(), calendar); return [new Temporal.Instant(987654321_000_000_000n)]; } } @@ -25,4 +25,4 @@ const result = plainDate.toZonedDateTime({ }); assert.sameValue(result.epochNanoseconds, 987654321_000_000_000n); assert.sameValue(result.timeZone, timeZone); -assert.sameValue(result.calendar, calendar); +assert.sameValue(result.getCalendar(), calendar); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js index 2dd1adb537..cdf6f3807c 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js @@ -14,15 +14,15 @@ const calendar = Temporal.Calendar.from("iso8601"); const objectResult = plainDate.withCalendar(calendar); assert.notSameValue(objectResult, plainDate, "object: new object"); TemporalHelpers.assertPlainDate(objectResult, 1976, 11, "M11", 18, "object"); -assert.sameValue(objectResult.calendar, calendar, "object: calendar"); +assert.sameValue(objectResult.getCalendar(), calendar, "object: calendar"); const stringResult = plainDate.withCalendar("iso8601"); assert.notSameValue(stringResult, plainDate, "string: new object"); TemporalHelpers.assertPlainDate(stringResult, 1976, 11, "M11", 18, "string"); -assert.sameValue(stringResult.calendar.id, "iso8601", "string: calendar"); +assert.sameValue(stringResult.getISOFields().calendar, "iso8601", "string: calendar slot stores a string"); -const originalCalendar = plainDate.calendar; +const originalCalendar = plainDate.getCalendar(); const sameResult = plainDate.withCalendar(originalCalendar); assert.notSameValue(sameResult, plainDate, "original: new object"); TemporalHelpers.assertPlainDate(sameResult, 1976, 11, "M11", 18, "original"); -assert.sameValue(sameResult.calendar, originalCalendar, "original: calendar"); +assert.sameValue(sameResult.getCalendar(), originalCalendar, "original: calendar slot stores and object"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js index 2199a02bac..cf154ed3d1 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); const arg = "iSo8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js index 1ff8a50d69..430b624754 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js @@ -12,7 +12,7 @@ const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); const arg = 19761118; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js index 7bd95a80cd..6382f00473 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js @@ -12,7 +12,7 @@ const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); let arg = "2016-12-31T23:59:60"; const result1 = instance.withCalendar(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -20,7 +20,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = instance.withCalendar(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js index 928e2979ca..39de48ee28 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js index 919710c361..2bd9587d6b 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js @@ -33,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); const result = instance.withCalendar(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js index f8dce94d51..0849422f4d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js @@ -25,6 +25,6 @@ TemporalHelpers.checkSubclassingIgnored( [customCalendar], (result) => { TemporalHelpers.assertPlainDate(result, 1900, 2, "M02", 5); - assert.sameValue(result.calendar, customCalendar, "calendar result"); + assert.sameValue(result.getCalendar(), customCalendar, "calendar result"); }, ); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDateTime/calendar-case-insensitive.js index b1528db051..2f096dd854 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-number.js b/test/built-ins/Temporal/PlainDateTime/calendar-number.js index c44989eaeb..b229949193 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-number.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/calendar-string.js index bde22b76bd..450c24c3a5 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/calendar-temporal-object.js index e3e3287d2c..0ef5ca40a8 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-undefined.js b/test/built-ins/Temporal/PlainDateTime/calendar-undefined.js index 5534057528..e4a692d263 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-undefined.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-undefined.js @@ -16,7 +16,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const dateTimeExplicit = new Temporal.PlainDateTime(...dateTimeArgs, undefined); -assert.sameValue(dateTimeExplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateTimeExplicit.calendarId, "iso8601"); const dateTimeImplicit = new Temporal.PlainDateTime(...dateTimeArgs); -assert.sameValue(dateTimeImplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateTimeImplicit.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/PlainDateTime/constructor-full.js b/test/built-ins/Temporal/PlainDateTime/constructor-full.js index 8715f22122..677ac59c19 100644 --- a/test/built-ins/Temporal/PlainDateTime/constructor-full.js +++ b/test/built-ins/Temporal/PlainDateTime/constructor-full.js @@ -17,7 +17,7 @@ TemporalHelpers.assertPlainDateTime(datetime, ); assert.sameValue( - datetime.calendar, + datetime.getCalendar(), calendar, "calendar supplied in constructor can be extracted and is unchanged" ); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js index 1994043454..693abbdb65 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js @@ -17,5 +17,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalPlainDateTimeFastPath((date, calendar) => { const result = Temporal.PlainDateTime.from(date); TemporalHelpers.assertPlainDateTime(result, 2000, 5, "M05", 2, 0, 0, 0, 0, 0, 0, "midnight is assumed"); - assert.sameValue(result.calendar, calendar, "calendar result"); + assert.sameValue(result.getCalendar(), calendar, "calendar result"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js index 9cefe93e65..ea0a21bf23 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js @@ -17,7 +17,7 @@ TemporalHelpers.assertPlainDateTime( "PlainDateTime is copied" ); -assert.sameValue(result.calendar, orig.calendar, "Calendar is copied"); +assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js index 6b76c86e59..3659a257c8 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const result = Temporal.PlainDateTime.from({ year: 2000, month: 5, day: 2, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/calendar/branding.js b/test/built-ins/Temporal/PlainDateTime/prototype/calendar/branding.js deleted file mode 100644 index bd6f81d610..0000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/calendar/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-temporal.plaindatetime.prototype.calendar -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const calendar = Object.getOwnPropertyDescriptor(Temporal.PlainDateTime.prototype, "calendar").get; - -assert.sameValue(typeof calendar, "function"); - -assert.throws(TypeError, () => calendar.call(undefined), "undefined"); -assert.throws(TypeError, () => calendar.call(null), "null"); -assert.throws(TypeError, () => calendar.call(true), "true"); -assert.throws(TypeError, () => calendar.call(""), "empty string"); -assert.throws(TypeError, () => calendar.call(Symbol()), "symbol"); -assert.throws(TypeError, () => calendar.call(1), "1"); -assert.throws(TypeError, () => calendar.call({}), "plain object"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainDateTime), "Temporal.PlainDateTime"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/calendarId/branding.js b/test/built-ins/Temporal/PlainDateTime/prototype/calendarId/branding.js new file mode 100644 index 0000000000..d3413c78ec --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/calendarId/branding.js @@ -0,0 +1,22 @@ +// 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.plaindatetime.prototype.calendarid +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const calendarId = Object.getOwnPropertyDescriptor(Temporal.PlainDateTime.prototype, "calendarId").get; + +assert.sameValue(typeof calendarId, "function"); + +assert.throws(TypeError, () => calendarId.call(undefined), "undefined"); +assert.throws(TypeError, () => calendarId.call(null), "null"); +assert.throws(TypeError, () => calendarId.call(true), "true"); +assert.throws(TypeError, () => calendarId.call(""), "empty string"); +assert.throws(TypeError, () => calendarId.call(Symbol()), "symbol"); +assert.throws(TypeError, () => calendarId.call(1), "1"); +assert.throws(TypeError, () => calendarId.call({}), "plain object"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainDateTime), "Temporal.PlainDateTime"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/calendar/prop-desc.js b/test/built-ins/Temporal/PlainDateTime/prototype/calendarId/prop-desc.js similarity index 71% rename from test/built-ins/Temporal/PlainYearMonth/prototype/calendar/prop-desc.js rename to test/built-ins/Temporal/PlainDateTime/prototype/calendarId/prop-desc.js index 2a0eacf082..2f9a40413a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/calendar/prop-desc.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/calendarId/prop-desc.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-get-temporal.plainyearmonth.prototype.calendar -description: The "calendar" property of Temporal.PlainYearMonth.prototype +esid: sec-get-temporal.plaindatetime.prototype.calendarid +description: The "calendarId" property of Temporal.PlainDateTime.prototype features: [Temporal] ---*/ -const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainYearMonth.prototype, "calendar"); +const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainDateTime.prototype, "calendarId"); assert.sameValue(typeof descriptor.get, "function"); assert.sameValue(descriptor.set, undefined); assert.sameValue(descriptor.enumerable, false); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/branding.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/branding.js new file mode 100644 index 0000000000..556f515cde --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/branding.js @@ -0,0 +1,22 @@ +// 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.plaindatetime.prototype.getcalendar +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getCalendar = Temporal.PlainDateTime.prototype.getCalendar; + +assert.sameValue(typeof getCalendar, "function"); + +assert.throws(TypeError, () => getCalendar.call(undefined), "undefined"); +assert.throws(TypeError, () => getCalendar.call(null), "null"); +assert.throws(TypeError, () => getCalendar.call(true), "true"); +assert.throws(TypeError, () => getCalendar.call(""), "empty string"); +assert.throws(TypeError, () => getCalendar.call(Symbol()), "symbol"); +assert.throws(TypeError, () => getCalendar.call(1), "1"); +assert.throws(TypeError, () => getCalendar.call({}), "plain object"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainDateTime), "Temporal.PlainDateTime"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/builtin.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/builtin.js new file mode 100644 index 0000000000..8073d1423d --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/builtin.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.getcalendar +description: > + Tests that Temporal.PlainDateTime.prototype.getCalendar + meets the requirements for built-in objects defined by the + introduction of chapter 17 of the ECMAScript Language Specification. +info: | + Built-in functions that are not constructors do not have a "prototype" property unless + otherwise specified in the description of a particular function. + + Unless specified otherwise, a built-in object that is callable as a function is a built-in + function object with the characteristics described in 10.3. Unless specified otherwise, the + [[Extensible]] internal slot of a built-in object initially has the value true. + + Unless otherwise specified every built-in function and every built-in constructor has the + Function prototype object [...] as the value of its [[Prototype]] internal slot. +features: [Temporal] +---*/ + +assert.sameValue(Object.isExtensible(Temporal.PlainDateTime.prototype.getCalendar), + true, "Built-in objects must be extensible."); + +assert.sameValue(Object.prototype.toString.call(Temporal.PlainDateTime.prototype.getCalendar), + "[object Function]", "Object.prototype.toString"); + +assert.sameValue(Object.getPrototypeOf(Temporal.PlainDateTime.prototype.getCalendar), + Function.prototype, "prototype"); + +assert.sameValue(Temporal.PlainDateTime.prototype.getCalendar.hasOwnProperty("prototype"), + false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/length.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/length.js new file mode 100644 index 0000000000..4aa0b2f9e5 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/length.js @@ -0,0 +1,25 @@ +// 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.plaindatetime.prototype.getcalendar +description: Temporal.PlainDateTime.prototype.getCalendar.length is 0 +info: | + Every built-in function object, including constructors, has a "length" property whose value is + an integer. Unless otherwise specified, this value is equal to the largest number of named + arguments shown in the subclause headings for the function description. Optional parameters + (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form + «...name») are not included in the default argument count. + + Unless otherwise specified, the "length" property of a built-in function object has the + attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainDateTime.prototype.getCalendar, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/name.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/name.js new file mode 100644 index 0000000000..55a49aa11f --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.getcalendar +description: Temporal.PlainDateTime.prototype.getCalendar.name is "getCalendar". +info: | + Every built-in function object, including constructors, that is not identified as an anonymous + function has a "name" property whose value is a String. Unless otherwise specified, this value + is the name that is given to the function in this specification. + + Unless otherwise specified, the "name" property of a built-in function object, if it exists, + has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainDateTime.prototype.getCalendar, "name", { + value: "getCalendar", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/not-a-constructor.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/not-a-constructor.js new file mode 100644 index 0000000000..1500ff41ce --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/not-a-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.getcalendar +description: > + Temporal.PlainDateTime.prototype.getCalendar does not implement [[Construct]], is not new-able +info: | + Built-in function objects that are not identified as constructors do not implement the + [[Construct]] internal method unless otherwise specified in the description of a particular + function. +includes: [isConstructor.js] +features: [Reflect.construct, Temporal] +---*/ + +assert.throws(TypeError, () => { + new Temporal.PlainDateTime.prototype.getCalendar(); +}, "Calling as constructor"); + +assert.sameValue(isConstructor(Temporal.PlainDateTime.prototype.getCalendar), false, + "isConstructor(Temporal.PlainDateTime.prototype.getCalendar)"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/prop-desc.js b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/prop-desc.js new file mode 100644 index 0000000000..0896290df6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getCalendar/prop-desc.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.getcalendar +description: The "getCalendar" property of Temporal.PlainDateTime.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.PlainDateTime.prototype.getCalendar, + "function", + "`typeof PlainDateTime.prototype.getCalendar` is `function`" +); + +verifyProperty(Temporal.PlainDateTime.prototype, "getCalendar", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-names.js b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-names.js index f444e829d5..d34f56f6d5 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-names.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-names.js @@ -19,4 +19,4 @@ assert.sameValue(result.isoSecond, 56, "isoSecond result"); assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); -assert.sameValue(result.calendar.id, "iso8601", "calendar result"); +assert.sameValue(result.calendar, "iso8601", "calendar result"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-plaindate-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-plaindate-calendar.js index 69f335a723..4ed21f10f7 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-plaindate-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-plaindate-calendar.js @@ -19,8 +19,8 @@ class Calendar extends Temporal.Calendar { } dateUntil(d1, d2) { - assert.sameValue(d1.calendar, this, "d1.calendar"); - assert.sameValue(d2.calendar, this, "d2.calendar"); + assert.sameValue(d1.getCalendar(), this, "d1.calendar"); + assert.sameValue(d2.getCalendar(), this, "d2.calendar"); return new Temporal.Duration(); } } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/basic.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/basic.js index 78d23ba942..3de71201de 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/basic.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/basic.js @@ -11,5 +11,5 @@ const dt = new Temporal.PlainDateTime(2020, 1, 1, 0, 0); const zdt = dt.toZonedDateTime("UTC"); assert.sameValue(zdt.epochNanoseconds, 1577836800000000000n, "nanoseconds"); -assert.sameValue(zdt.calendar.toString(), "iso8601", "calendar"); +assert.sameValue(zdt.calendarId, "iso8601", "calendar"); assert.sameValue(zdt.timeZone.toString(), "UTC", "timezone"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js index 9549832a30..51bf0b0cc5 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js @@ -40,6 +40,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { const result = dateTime.toZonedDateTime(timeZone, options); assert.sameValue(result.epochNanoseconds, instant.epochNanoseconds); assert.sameValue(result.timeZone, timeZone); -assert.sameValue(result.calendar, dateTime.calendar); - assert.compareArray(actual, expected); + +assert.sameValue(result.getISOFields().calendar, dateTime.getISOFields().calendar); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-plaindate-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-plaindate-calendar.js index 7f255df452..ba28347ed6 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-plaindate-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-plaindate-calendar.js @@ -19,8 +19,8 @@ class Calendar extends Temporal.Calendar { } dateUntil(d1, d2) { - assert.sameValue(d1.calendar, this, "d1.calendar"); - assert.sameValue(d2.calendar, this, "d2.calendar"); + assert.sameValue(d1.getCalendar(), this, "d1.calendar"); + assert.sameValue(d2.getCalendar(), this, "d2.calendar"); return new Temporal.Duration(); } } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js index 318f552ab5..3e5f2f4bc8 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js @@ -19,4 +19,4 @@ TemporalHelpers.assertPlainDateTime( "works" ); -assert.sameValue(result.calendar, calendar, "underlying calendar is unchanged"); +assert.sameValue(result.getCalendar(), calendar, "underlying calendar is unchanged"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js index cdca3fe44f..026d8ed46d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, const arg = "iSo8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js index 3289014fc4..adae39f20d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js @@ -12,7 +12,7 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, const arg = 19761118; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js index 02ea408591..44cade306b 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js @@ -12,7 +12,7 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, let arg = "2016-12-31T23:59:60"; const result1 = instance.withCalendar(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -20,7 +20,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = instance.withCalendar(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js index 68f1313e47..35d532b79e 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js index f070f11fe0..76333c86ae 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -33,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); const result = instance.withCalendar(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js index 749bdd6694..79463912ef 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js @@ -25,6 +25,6 @@ TemporalHelpers.checkSubclassingIgnored( [customCalendar], (result) => { TemporalHelpers.assertPlainDateTime(result, 1900, 2, "M02", 5, 12, 34, 56, 987, 654, 321); - assert.sameValue(result.calendar, customCalendar, "calendar result"); + assert.sameValue(result.getCalendar(), customCalendar, "calendar result"); }, ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js index 548a9378a6..7fbc3e41e0 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js @@ -19,7 +19,7 @@ const cal = { day() { return 6; } }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0); -assert.sameValue(pdt.calendar.toString(), "iso8601", "PlainDateTime with ISO calendar"); +assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar"); const pd = new Temporal.PlainDate(2010, 11, 12, cal); const shifted = pdt.withPlainDate(pd); @@ -31,7 +31,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is changed if receiver has ISO calendar (2)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js index 7abc86730e..caf056f49e 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js @@ -33,7 +33,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal2, "calendar is changed with same id (2)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js index bfe7f3755c..53b7ddacb8 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js @@ -34,7 +34,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged with same calendars (2)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js index 58864db07d..bc8d9a927c 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js @@ -20,7 +20,7 @@ const cal = { }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12); -assert.sameValue(pd.calendar.toString(), "iso8601", "PlainDate with ISO calendar"); +assert.sameValue(pd.calendarId, "iso8601", "PlainDate with ISO calendar"); const shifted = pdt.withPlainDate(pd); TemporalHelpers.assertPlainDateTime( @@ -31,7 +31,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged if input has ISO calendar (2)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js index 45e3d8bf07..5432793271 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js @@ -29,7 +29,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged if input has ISO calendar (2)" ); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-temporal-object.js index b2c9b06eb1..779b2d1812 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-temporal-object.js @@ -24,5 +24,5 @@ TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const datetime = new Temporal.PlainDateTime(2000, 5, 3, 13, 3, 27, 123, 456, 789); // the PlainDate's calendar will override the PlainDateTime's ISO calendar const result = datetime.withPlainDate({ year: 2001, month: 6, day: 4, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainMonthDay/basic.js b/test/built-ins/Temporal/PlainMonthDay/basic.js index f854cfb450..6eb362da1c 100644 --- a/test/built-ins/Temporal/PlainMonthDay/basic.js +++ b/test/built-ins/Temporal/PlainMonthDay/basic.js @@ -10,12 +10,12 @@ features: [Temporal] const leapDay = new Temporal.PlainMonthDay(2, 29); TemporalHelpers.assertPlainMonthDay(leapDay, "M02", 29, "leap day is supported"); -assert.sameValue(leapDay.calendar.id, "iso8601", "leap day calendar"); +assert.sameValue(leapDay.calendarId, "iso8601", "leap day calendar"); const beforeEpoch = new Temporal.PlainMonthDay(12, 2, "iso8601", 1920); TemporalHelpers.assertPlainMonthDay(beforeEpoch, "M12", 2, "reference year before epoch", 1920); -assert.sameValue(beforeEpoch.calendar.id, "iso8601", "reference year before epoch calendar"); +assert.sameValue(beforeEpoch.calendarId, "iso8601", "reference year before epoch calendar"); const afterEpoch = new Temporal.PlainMonthDay(1, 7, "iso8601", 1980); TemporalHelpers.assertPlainMonthDay(afterEpoch, "M01", 7, "reference year after epoch", 1980); -assert.sameValue(afterEpoch.calendar.id, "iso8601", "reference year after epoch calendar"); +assert.sameValue(afterEpoch.calendarId, "iso8601", "reference year after epoch calendar"); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainMonthDay/calendar-case-insensitive.js index 7edc60b922..e42d4d19c4 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-number.js b/test/built-ins/Temporal/PlainMonthDay/calendar-number.js index bc2edac62f..99f99d9c2b 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-number.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js index cc41c4d0eb..222645121f 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-temporal-object.js b/test/built-ins/Temporal/PlainMonthDay/calendar-temporal-object.js index 1e184a913c..fa1fa9ba33 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-undefined.js b/test/built-ins/Temporal/PlainMonthDay/calendar-undefined.js index 2b7d1d6db2..442da5e735 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-undefined.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-undefined.js @@ -16,7 +16,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const dateExplicit = new Temporal.PlainMonthDay(...args, undefined); -assert.sameValue(dateExplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateExplicit.calendarId, "iso8601"); const dateImplicit = new Temporal.PlainMonthDay(...args); -assert.sameValue(dateImplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateImplicit.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js index 214c541e45..760ae71fd1 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js @@ -18,7 +18,7 @@ TemporalHelpers.assertPlainMonthDay( /* isoYear = */ 2000 ); -assert.sameValue(result.calendar, orig.calendar, "Calendar is copied"); +assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js index 98a61cf221..5746c98015 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const result = Temporal.PlainMonthDay.from({ monthCode: "M05", day: 2, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/fields-object.js b/test/built-ins/Temporal/PlainMonthDay/from/fields-object.js index b8a9038492..ed5b26325d 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/fields-object.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/fields-object.js @@ -22,5 +22,5 @@ for (const [argument, description = argument] of tests) { const plainMonthDay = Temporal.PlainMonthDay.from(argument); assert.notSameValue(plainMonthDay, argument, `from ${description} converts`); TemporalHelpers.assertPlainMonthDay(plainMonthDay, "M10", 1, `from ${description}`); - assert.sameValue(plainMonthDay.calendar.id, "iso8601", `from ${description} calendar`); + assert.sameValue(plainMonthDay.calendarId, "iso8601", `from ${description} calendar`); } diff --git a/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js b/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js index 007d629ed4..9248f77e3f 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js @@ -12,7 +12,7 @@ for (const argument of TemporalHelpers.ISO.plainMonthDayStringsValid()) { const plainMonthDay = Temporal.PlainMonthDay.from(argument); assert.notSameValue(plainMonthDay, argument, `from ${argument} converts`); TemporalHelpers.assertPlainMonthDay(plainMonthDay, "M10", 1, `from ${argument}`); - assert.sameValue(plainMonthDay.calendar.id, "iso8601", `from ${argument} calendar`); + assert.sameValue(plainMonthDay.calendarId, "iso8601", `from ${argument} calendar`); } for (const arg of TemporalHelpers.ISO.plainMonthDayStringsInvalid()) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/calendar/branding.js b/test/built-ins/Temporal/PlainMonthDay/prototype/calendar/branding.js deleted file mode 100644 index adf20ff9ae..0000000000 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/calendar/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-temporal.plainmonthday.prototype.calendar -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const calendar = Object.getOwnPropertyDescriptor(Temporal.PlainMonthDay.prototype, "calendar").get; - -assert.sameValue(typeof calendar, "function"); - -assert.throws(TypeError, () => calendar.call(undefined), "undefined"); -assert.throws(TypeError, () => calendar.call(null), "null"); -assert.throws(TypeError, () => calendar.call(true), "true"); -assert.throws(TypeError, () => calendar.call(""), "empty string"); -assert.throws(TypeError, () => calendar.call(Symbol()), "symbol"); -assert.throws(TypeError, () => calendar.call(1), "1"); -assert.throws(TypeError, () => calendar.call({}), "plain object"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainMonthDay), "Temporal.PlainMonthDay"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainMonthDay.prototype), "Temporal.PlainMonthDay.prototype"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/branding.js b/test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/branding.js new file mode 100644 index 0000000000..85997673d9 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/branding.js @@ -0,0 +1,22 @@ +// 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.plainmonthday.prototype.calendarid +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const calendarId = Object.getOwnPropertyDescriptor(Temporal.PlainMonthDay.prototype, "calendarId").get; + +assert.sameValue(typeof calendarId, "function"); + +assert.throws(TypeError, () => calendarId.call(undefined), "undefined"); +assert.throws(TypeError, () => calendarId.call(null), "null"); +assert.throws(TypeError, () => calendarId.call(true), "true"); +assert.throws(TypeError, () => calendarId.call(""), "empty string"); +assert.throws(TypeError, () => calendarId.call(Symbol()), "symbol"); +assert.throws(TypeError, () => calendarId.call(1), "1"); +assert.throws(TypeError, () => calendarId.call({}), "plain object"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainMonthDay), "Temporal.PlainMonthDay"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainMonthDay.prototype), "Temporal.PlainMonthDay.prototype"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/calendar/prop-desc.js b/test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/prop-desc.js similarity index 71% rename from test/built-ins/Temporal/PlainMonthDay/prototype/calendar/prop-desc.js rename to test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/prop-desc.js index a428d164ea..9ca2b1a5ae 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/calendar/prop-desc.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/calendarId/prop-desc.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-get-temporal.plainmonthday.prototype.calendar -description: The "calendar" property of Temporal.PlainMonthDay.prototype +esid: sec-get-temporal.plainmonthday.prototype.calendarid +description: The "calendarId" property of Temporal.PlainMonthDay.prototype features: [Temporal] ---*/ -const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainMonthDay.prototype, "calendar"); +const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainMonthDay.prototype, "calendarId"); assert.sameValue(typeof descriptor.get, "function"); assert.sameValue(descriptor.set, undefined); assert.sameValue(descriptor.enumerable, false); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/branding.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/branding.js new file mode 100644 index 0000000000..91492e579c --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/branding.js @@ -0,0 +1,22 @@ +// 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.plainmonthday.prototype.getcalendar +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getCalendar = Temporal.PlainMonthDay.prototype.getCalendar; + +assert.sameValue(typeof getCalendar, "function"); + +assert.throws(TypeError, () => getCalendar.call(undefined), "undefined"); +assert.throws(TypeError, () => getCalendar.call(null), "null"); +assert.throws(TypeError, () => getCalendar.call(true), "true"); +assert.throws(TypeError, () => getCalendar.call(""), "empty string"); +assert.throws(TypeError, () => getCalendar.call(Symbol()), "symbol"); +assert.throws(TypeError, () => getCalendar.call(1), "1"); +assert.throws(TypeError, () => getCalendar.call({}), "plain object"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainMonthDay), "Temporal.PlainMonthDay"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainMonthDay.prototype), "Temporal.PlainMonthDay.prototype"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/builtin.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/builtin.js new file mode 100644 index 0000000000..8a80d45352 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/builtin.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.getcalendar +description: > + Tests that Temporal.PlainMonthDay.prototype.getCalendar + meets the requirements for built-in objects defined by the + introduction of chapter 17 of the ECMAScript Language Specification. +info: | + Built-in functions that are not constructors do not have a "prototype" property unless + otherwise specified in the description of a particular function. + + Unless specified otherwise, a built-in object that is callable as a function is a built-in + function object with the characteristics described in 10.3. Unless specified otherwise, the + [[Extensible]] internal slot of a built-in object initially has the value true. + + Unless otherwise specified every built-in function and every built-in constructor has the + Function prototype object [...] as the value of its [[Prototype]] internal slot. +features: [Temporal] +---*/ + +assert.sameValue(Object.isExtensible(Temporal.PlainMonthDay.prototype.getCalendar), + true, "Built-in objects must be extensible."); + +assert.sameValue(Object.prototype.toString.call(Temporal.PlainMonthDay.prototype.getCalendar), + "[object Function]", "Object.prototype.toString"); + +assert.sameValue(Object.getPrototypeOf(Temporal.PlainMonthDay.prototype.getCalendar), + Function.prototype, "prototype"); + +assert.sameValue(Temporal.PlainMonthDay.prototype.getCalendar.hasOwnProperty("prototype"), + false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/length.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/length.js new file mode 100644 index 0000000000..a79f3e8b60 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/length.js @@ -0,0 +1,25 @@ +// 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.plainmonthday.prototype.getcalendar +description: Temporal.PlainMonthDay.prototype.getCalendar.length is 0 +info: | + Every built-in function object, including constructors, has a "length" property whose value is + an integer. Unless otherwise specified, this value is equal to the largest number of named + arguments shown in the subclause headings for the function description. Optional parameters + (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form + «...name») are not included in the default argument count. + + Unless otherwise specified, the "length" property of a built-in function object has the + attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainMonthDay.prototype.getCalendar, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/name.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/name.js new file mode 100644 index 0000000000..f02a73ddaf --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.getcalendar +description: Temporal.PlainMonthDay.prototype.getCalendar.name is "getCalendar". +info: | + Every built-in function object, including constructors, that is not identified as an anonymous + function has a "name" property whose value is a String. Unless otherwise specified, this value + is the name that is given to the function in this specification. + + Unless otherwise specified, the "name" property of a built-in function object, if it exists, + has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainMonthDay.prototype.getCalendar, "name", { + value: "getCalendar", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/not-a-constructor.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/not-a-constructor.js new file mode 100644 index 0000000000..54c34ebb59 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/not-a-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.getcalendar +description: > + Temporal.PlainMonthDay.prototype.getCalendar does not implement [[Construct]], is not new-able +info: | + Built-in function objects that are not identified as constructors do not implement the + [[Construct]] internal method unless otherwise specified in the description of a particular + function. +includes: [isConstructor.js] +features: [Reflect.construct, Temporal] +---*/ + +assert.throws(TypeError, () => { + new Temporal.PlainMonthDay.prototype.getCalendar(); +}, "Calling as constructor"); + +assert.sameValue(isConstructor(Temporal.PlainMonthDay.prototype.getCalendar), false, + "isConstructor(Temporal.PlainMonthDay.prototype.getCalendar)"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/prop-desc.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/prop-desc.js new file mode 100644 index 0000000000..70da030514 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getCalendar/prop-desc.js @@ -0,0 +1,21 @@ +// 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.plainmonthday.prototype.getcalendar +description: The "getCalendar" property of Temporal.PlainMonthDay.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.PlainMonthDay.prototype.getCalendar, + "function", + "`typeof PlainMonthDay.prototype.getCalendar` is `function`" +); + +verifyProperty(Temporal.PlainMonthDay.prototype, "getCalendar", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-names.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-names.js index 87cedb2153..9b99f014e6 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-names.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-names.js @@ -13,4 +13,4 @@ const result = md.getISOFields(); assert.sameValue(result.isoYear, 1972, "isoYear result"); assert.sameValue(result.isoMonth, 5, "isoMonth result"); assert.sameValue(result.isoDay, 2, "isoDay result"); -assert.sameValue(result.calendar.id, "iso8601", "calendar result"); +assert.sameValue(result.calendar, "iso8601", "calendar result"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object.js index c165f41d6d..97146e9264 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object.js @@ -23,5 +23,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const time = new Temporal.PlainTime(13, 3); const result = time.toPlainDateTime({ year: 2000, month: 5, day: 3, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-temporal-object.js index 400e9cbacb..23372a953a 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-temporal-object.js @@ -23,5 +23,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const time = new Temporal.PlainTime(13, 3); const result = time.toZonedDateTime({ timeZone: "UTC", plainDate: { year: 2000, month: 5, day: 3, calendar: temporalObject } }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainYearMonth/calendar-case-insensitive.js index 9160f56487..7c6d96efce 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-number.js b/test/built-ins/Temporal/PlainYearMonth/calendar-number.js index cf7d4142a5..4b22e59ebf 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-number.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js index 1c2be402ae..d9f558955c 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-temporal-object.js b/test/built-ins/Temporal/PlainYearMonth/calendar-temporal-object.js index a5ea5b5b55..e9fb1c9c0a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-undefined.js b/test/built-ins/Temporal/PlainYearMonth/calendar-undefined.js index 457e632418..d08947cec8 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-undefined.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-undefined.js @@ -16,7 +16,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const dateExplicit = new Temporal.PlainYearMonth(...args, undefined); -assert.sameValue(dateExplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateExplicit.calendarId, "iso8601"); const dateImplicit = new Temporal.PlainYearMonth(...args); -assert.sameValue(dateImplicit.calendar.toString(), "iso8601"); +assert.sameValue(dateImplicit.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js index e423a148e8..9923c808eb 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js @@ -12,7 +12,7 @@ const plainDate = Temporal.PlainDate.from("1976-11-18"); const plainYearMonth = Temporal.PlainYearMonth.from(plainDate); TemporalHelpers.assertPlainYearMonth(plainYearMonth, 1976, 11, "M11"); const fields = plainYearMonth.getISOFields(); -assert.sameValue(fields.calendar.id, "iso8601"); +assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); assert.sameValue(fields.isoDay, 1, "isoDay"); assert.sameValue(fields.isoMonth, 11, "isoMonth"); assert.sameValue(fields.isoYear, 1976, "isoYear"); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js index b8196919b5..9dd8f55b37 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js @@ -18,7 +18,7 @@ TemporalHelpers.assertPlainYearMonth( /* era = */ undefined, /* eraYear = */ undefined, /* isoDay = */ 7 ); -assert.sameValue(result.calendar, orig.calendar, "Calendar is copied"); +assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js index 4d90936bcf..dc897c34dd 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js @@ -12,7 +12,7 @@ for (const input of TemporalHelpers.ISO.plainYearMonthStringsValid()) { const plainYearMonth = Temporal.PlainYearMonth.from(input); TemporalHelpers.assertPlainYearMonth(plainYearMonth, 1976, 11, "M11"); const fields = plainYearMonth.getISOFields(); - assert.sameValue(fields.calendar.id, "iso8601"); + assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); assert.sameValue(fields.isoDay, 1, "isoDay"); assert.sameValue(fields.isoMonth, 11, "isoMonth"); assert.sameValue(fields.isoYear, 1976, "isoYear"); @@ -22,7 +22,7 @@ for (const input of TemporalHelpers.ISO.plainYearMonthStringsValidNegativeYear() const plainYearMonth = Temporal.PlainYearMonth.from(input); TemporalHelpers.assertPlainYearMonth(plainYearMonth, -9999, 11, "M11"); const fields = plainYearMonth.getISOFields(); - assert.sameValue(fields.calendar.id, "iso8601"); + assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); assert.sameValue(fields.isoDay, 1, "isoDay"); assert.sameValue(fields.isoMonth, 11, "isoMonth"); assert.sameValue(fields.isoYear, -9999, "isoYear"); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js index f2d3897f46..050e990a0f 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const result = Temporal.PlainYearMonth.from({ year: 2000, month: 5, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/calendar/branding.js b/test/built-ins/Temporal/PlainYearMonth/prototype/calendar/branding.js deleted file mode 100644 index 4235571465..0000000000 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/calendar/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-temporal.plainyearmonth.prototype.calendar -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const calendar = Object.getOwnPropertyDescriptor(Temporal.PlainYearMonth.prototype, "calendar").get; - -assert.sameValue(typeof calendar, "function"); - -assert.throws(TypeError, () => calendar.call(undefined), "undefined"); -assert.throws(TypeError, () => calendar.call(null), "null"); -assert.throws(TypeError, () => calendar.call(true), "true"); -assert.throws(TypeError, () => calendar.call(""), "empty string"); -assert.throws(TypeError, () => calendar.call(Symbol()), "symbol"); -assert.throws(TypeError, () => calendar.call(1), "1"); -assert.throws(TypeError, () => calendar.call({}), "plain object"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainYearMonth), "Temporal.PlainYearMonth"); -assert.throws(TypeError, () => calendar.call(Temporal.PlainYearMonth.prototype), "Temporal.PlainYearMonth.prototype"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/branding.js b/test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/branding.js new file mode 100644 index 0000000000..5bad236cb3 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/branding.js @@ -0,0 +1,22 @@ +// 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.plainyearmonth.prototype.calendarid +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const calendarId = Object.getOwnPropertyDescriptor(Temporal.PlainYearMonth.prototype, "calendarId").get; + +assert.sameValue(typeof calendarId, "function"); + +assert.throws(TypeError, () => calendarId.call(undefined), "undefined"); +assert.throws(TypeError, () => calendarId.call(null), "null"); +assert.throws(TypeError, () => calendarId.call(true), "true"); +assert.throws(TypeError, () => calendarId.call(""), "empty string"); +assert.throws(TypeError, () => calendarId.call(Symbol()), "symbol"); +assert.throws(TypeError, () => calendarId.call(1), "1"); +assert.throws(TypeError, () => calendarId.call({}), "plain object"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainYearMonth), "Temporal.PlainYearMonth"); +assert.throws(TypeError, () => calendarId.call(Temporal.PlainYearMonth.prototype), "Temporal.PlainYearMonth.prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/calendar/prop-desc.js b/test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/prop-desc.js similarity index 70% rename from test/built-ins/Temporal/PlainDateTime/prototype/calendar/prop-desc.js rename to test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/prop-desc.js index 9d3342896c..b0ef8d7b08 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/calendar/prop-desc.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/calendarId/prop-desc.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-get-temporal.plaindatetime.prototype.calendar -description: The "calendar" property of Temporal.PlainDateTime.prototype +esid: sec-get-temporal.plainyearmonth.prototype.calendarid +description: The "calendarId" property of Temporal.PlainYearMonth.prototype features: [Temporal] ---*/ -const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainDateTime.prototype, "calendar"); +const descriptor = Object.getOwnPropertyDescriptor(Temporal.PlainYearMonth.prototype, "calendarId"); assert.sameValue(typeof descriptor.get, "function"); assert.sameValue(descriptor.set, undefined); assert.sameValue(descriptor.enumerable, false); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/branding.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/branding.js new file mode 100644 index 0000000000..86293ae250 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/branding.js @@ -0,0 +1,22 @@ +// 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.plainyearmonth.prototype.getcalendar +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getCalendar = Temporal.PlainYearMonth.prototype.getCalendar; + +assert.sameValue(typeof getCalendar, "function"); + +assert.throws(TypeError, () => getCalendar.call(undefined), "undefined"); +assert.throws(TypeError, () => getCalendar.call(null), "null"); +assert.throws(TypeError, () => getCalendar.call(true), "true"); +assert.throws(TypeError, () => getCalendar.call(""), "empty string"); +assert.throws(TypeError, () => getCalendar.call(Symbol()), "symbol"); +assert.throws(TypeError, () => getCalendar.call(1), "1"); +assert.throws(TypeError, () => getCalendar.call({}), "plain object"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainYearMonth), "Temporal.PlainYearMonth"); +assert.throws(TypeError, () => getCalendar.call(Temporal.PlainYearMonth.prototype), "Temporal.PlainYearMonth.prototype"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/builtin.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/builtin.js new file mode 100644 index 0000000000..a83fbdabe3 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/builtin.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.getcalendar +description: > + Tests that Temporal.PlainYearMonth.prototype.getCalendar + meets the requirements for built-in objects defined by the + introduction of chapter 17 of the ECMAScript Language Specification. +info: | + Built-in functions that are not constructors do not have a "prototype" property unless + otherwise specified in the description of a particular function. + + Unless specified otherwise, a built-in object that is callable as a function is a built-in + function object with the characteristics described in 10.3. Unless specified otherwise, the + [[Extensible]] internal slot of a built-in object initially has the value true. + + Unless otherwise specified every built-in function and every built-in constructor has the + Function prototype object [...] as the value of its [[Prototype]] internal slot. +features: [Temporal] +---*/ + +assert.sameValue(Object.isExtensible(Temporal.PlainYearMonth.prototype.getCalendar), + true, "Built-in objects must be extensible."); + +assert.sameValue(Object.prototype.toString.call(Temporal.PlainYearMonth.prototype.getCalendar), + "[object Function]", "Object.prototype.toString"); + +assert.sameValue(Object.getPrototypeOf(Temporal.PlainYearMonth.prototype.getCalendar), + Function.prototype, "prototype"); + +assert.sameValue(Temporal.PlainYearMonth.prototype.getCalendar.hasOwnProperty("prototype"), + false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/length.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/length.js new file mode 100644 index 0000000000..3105dd5b7e --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/length.js @@ -0,0 +1,25 @@ +// 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.plainyearmonth.prototype.getcalendar +description: Temporal.PlainYearMonth.prototype.getCalendar.length is 0 +info: | + Every built-in function object, including constructors, has a "length" property whose value is + an integer. Unless otherwise specified, this value is equal to the largest number of named + arguments shown in the subclause headings for the function description. Optional parameters + (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form + «...name») are not included in the default argument count. + + Unless otherwise specified, the "length" property of a built-in function object has the + attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainYearMonth.prototype.getCalendar, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/name.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/name.js new file mode 100644 index 0000000000..f12a2525d7 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.getcalendar +description: Temporal.PlainYearMonth.prototype.getCalendar.name is "getCalendar". +info: | + Every built-in function object, including constructors, that is not identified as an anonymous + function has a "name" property whose value is a String. Unless otherwise specified, this value + is the name that is given to the function in this specification. + + Unless otherwise specified, the "name" property of a built-in function object, if it exists, + has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.PlainYearMonth.prototype.getCalendar, "name", { + value: "getCalendar", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/not-a-constructor.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/not-a-constructor.js new file mode 100644 index 0000000000..a5fd3b5306 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/not-a-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.getcalendar +description: > + Temporal.PlainYearMonth.prototype.getCalendar does not implement [[Construct]], is not new-able +info: | + Built-in function objects that are not identified as constructors do not implement the + [[Construct]] internal method unless otherwise specified in the description of a particular + function. +includes: [isConstructor.js] +features: [Reflect.construct, Temporal] +---*/ + +assert.throws(TypeError, () => { + new Temporal.PlainYearMonth.prototype.getCalendar(); +}, "Calling as constructor"); + +assert.sameValue(isConstructor(Temporal.PlainYearMonth.prototype.getCalendar), false, + "isConstructor(Temporal.PlainYearMonth.prototype.getCalendar)"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/prop-desc.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/prop-desc.js new file mode 100644 index 0000000000..7a2db16e2c --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getCalendar/prop-desc.js @@ -0,0 +1,21 @@ +// 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.plainyearmonth.prototype.getcalendar +description: The "getCalendar" property of Temporal.PlainYearMonth.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.PlainYearMonth.prototype.getCalendar, + "function", + "`typeof PlainYearMonth.prototype.getCalendar` is `function`" +); + +verifyProperty(Temporal.PlainYearMonth.prototype, "getCalendar", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-names.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-names.js index 631c02891d..9684bb591e 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-names.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-names.js @@ -13,4 +13,4 @@ const result = ym.getISOFields(); assert.sameValue(result.isoYear, 2000, "isoYear result"); assert.sameValue(result.isoMonth, 5, "isoMonth result"); assert.sameValue(result.isoDay, 1, "isoDay result"); -assert.sameValue(result.calendar.id, "iso8601", "calendar result"); +assert.sameValue(result.calendar, "iso8601", "calendar result"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-case-insensitive.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-case-insensitive.js index c7ae3d6e5f..0cc75d0e91 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.TimeZone("UTC"); const arg = "iSo8601"; const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-number.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-number.js index 97a6429cd5..f48725772e 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-number.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-number.js @@ -12,7 +12,7 @@ const instance = new Temporal.TimeZone("UTC"); const arg = 19761118; const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string-leap-second.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string-leap-second.js index 927df49001..9a228c6ec1 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string-leap-second.js @@ -12,7 +12,7 @@ const instance = new Temporal.TimeZone("UTC"); let arg = "2016-12-31T23:59:60"; const result1 = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -20,7 +20,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js index f97f14a433..fe3d4932a2 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.TimeZone("UTC"); const arg = "iso8601"; const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-temporal-object.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-temporal-object.js index 5b16830075..345d50f60b 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-temporal-object.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-temporal-object.js @@ -33,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.TimeZone("UTC"); const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-undefined.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-undefined.js index 92add0be1c..6c0d705436 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-undefined.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-undefined.js @@ -17,7 +17,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const result1 = timeZone.getPlainDateTimeFor(instant); -assert.sameValue(result1.calendar.toString(), "iso8601"); +assert.sameValue(result1.calendarId, "iso8601"); const result2 = timeZone.getPlainDateTimeFor(instant, undefined); -assert.sameValue(result2.calendar.toString(), "iso8601"); +assert.sameValue(result2.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-case-insensitive.js b/test/built-ins/Temporal/ZonedDateTime/calendar-case-insensitive.js index a2c19488b2..f7b725c797 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-case-insensitive.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iSo8601"; const result = new Temporal.ZonedDateTime(0n, "UTC", arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-number.js b/test/built-ins/Temporal/ZonedDateTime/calendar-number.js index 889bf726c8..1d2409c110 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-number.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-number.js @@ -10,7 +10,7 @@ features: [Temporal] const arg = 19761118; const result = new Temporal.ZonedDateTime(0n, "UTC", arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js index 783609253a..35be85afeb 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.ZonedDateTime(0n, "UTC", arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/calendar-temporal-object.js index a66e68fd14..4f423ba86e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-temporal-object.js @@ -32,7 +32,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }); const result = new Temporal.ZonedDateTime(0n, "UTC", arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js b/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js index baaf93c7f0..0de531db8a 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js @@ -16,7 +16,7 @@ Object.defineProperty(Temporal.Calendar, "from", { }); const explicit = new Temporal.ZonedDateTime(...args, undefined); -assert.sameValue(explicit.calendar.toString(), "iso8601"); +assert.sameValue(explicit.getISOFields().calendar, "iso8601", "calendar slot should store a string"); const implicit = new Temporal.ZonedDateTime(...args); -assert.sameValue(implicit.calendar.toString(), "iso8601"); +assert.sameValue(implicit.getISOFields().calendar, "iso8601", "calendar slot should store a string"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-case-insensitive.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-case-insensitive.js index 4b270f898a..841f912ea5 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-case-insensitive.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-case-insensitive.js @@ -12,8 +12,8 @@ const calendar = "IsO8601"; const timeZone = new Temporal.TimeZone("UTC"); let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result1 = Temporal.ZonedDateTime.from(arg); -assert.sameValue(result1.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result1.calendarId, "iso8601", "Calendar is case-insensitive"); arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } }; const result2 = Temporal.ZonedDateTime.from(arg); -assert.sameValue(result2.calendar.id, "iso8601", "Calendar is case-insensitive (nested property)"); +assert.sameValue(result2.calendarId, "iso8601", "Calendar is case-insensitive (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-leap-second.js index 2d68e15b72..161b46e116 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-leap-second.js @@ -13,7 +13,7 @@ const calendar = "2016-12-31T23:59:60+00:00[UTC]"; let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result1 = Temporal.ZonedDateTime.from(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for calendar" ); @@ -21,7 +21,7 @@ assert.sameValue( arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } }; const result2 = Temporal.ZonedDateTime.from(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for calendar (nested property)" ); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-number.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-number.js index 58775d77ae..6ebe6a7f3c 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-number.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-number.js @@ -12,11 +12,11 @@ const calendar = 19970327; const timeZone = new Temporal.TimeZone("UTC"); let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result1 = Temporal.ZonedDateTime.from(arg); -assert.sameValue(result1.calendar.id, "iso8601", "19970327 is a valid ISO string for calendar"); +assert.sameValue(result1.calendarId, "iso8601", "19970327 is a valid ISO string for calendar"); arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } }; const result2 = Temporal.ZonedDateTime.from(arg); -assert.sameValue(result2.calendar.id, "iso8601", "19970327 is a valid ISO string for calendar (nested property)"); +assert.sameValue(result2.calendarId, "iso8601", "19970327 is a valid ISO string for calendar (nested property)"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js index bbaff1285f..8383a02e8a 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js @@ -12,4 +12,4 @@ const calendar = "iso8601"; const timeZone = new Temporal.TimeZone("UTC"); const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result = Temporal.ZonedDateTime.from(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${calendar}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js index 8bf82dcaf1..c6c27b56b4 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js @@ -17,9 +17,5 @@ const tests = [ tests.forEach(([arg, description]) => { const result = Temporal.ZonedDateTime.from(arg); - assert.sameValue( - result.calendar.toString(), - "iso8601", - `calendar annotation (${description})` - ); + assert.sameValue(result.calendarId, "iso8601", `calendar annotation (${description})`); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js index eb1c6c67ae..d1452483ce 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js @@ -12,7 +12,7 @@ const result = Temporal.ZonedDateTime.from(orig); assert.sameValue(result.epochNanoseconds, 946684800_000_000_010n, "ZonedDateTime is copied"); assert.sameValue(result.timeZone, orig.timeZone, "time zone is the same"); -assert.sameValue(result.calendar, orig.calendar, "calendar is the same"); +assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "calendar is the same"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js index 60ffe57b21..0489c49925 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: "UTC", calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/calendar/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/calendar/branding.js deleted file mode 100644 index ba792ca71a..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/calendar/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-temporal.zoneddatetime.prototype.calendar -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const calendar = Object.getOwnPropertyDescriptor(Temporal.ZonedDateTime.prototype, "calendar").get; - -assert.sameValue(typeof calendar, "function"); - -assert.throws(TypeError, () => calendar.call(undefined), "undefined"); -assert.throws(TypeError, () => calendar.call(null), "null"); -assert.throws(TypeError, () => calendar.call(true), "true"); -assert.throws(TypeError, () => calendar.call(""), "empty string"); -assert.throws(TypeError, () => calendar.call(Symbol()), "symbol"); -assert.throws(TypeError, () => calendar.call(1), "1"); -assert.throws(TypeError, () => calendar.call({}), "plain object"); -assert.throws(TypeError, () => calendar.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime"); -assert.throws(TypeError, () => calendar.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/branding.js new file mode 100644 index 0000000000..813bf47808 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/branding.js @@ -0,0 +1,22 @@ +// 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.zoneddatetime.prototype.calendarid +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const calendarId = Object.getOwnPropertyDescriptor(Temporal.ZonedDateTime.prototype, "calendarId").get; + +assert.sameValue(typeof calendarId, "function"); + +assert.throws(TypeError, () => calendarId.call(undefined), "undefined"); +assert.throws(TypeError, () => calendarId.call(null), "null"); +assert.throws(TypeError, () => calendarId.call(true), "true"); +assert.throws(TypeError, () => calendarId.call(""), "empty string"); +assert.throws(TypeError, () => calendarId.call(Symbol()), "symbol"); +assert.throws(TypeError, () => calendarId.call(1), "1"); +assert.throws(TypeError, () => calendarId.call({}), "plain object"); +assert.throws(TypeError, () => calendarId.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime"); +assert.throws(TypeError, () => calendarId.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/calendar/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/prop-desc.js similarity index 71% rename from test/built-ins/Temporal/ZonedDateTime/prototype/calendar/prop-desc.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/prop-desc.js index 323413d3c1..93cad46ad6 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/calendar/prop-desc.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/calendarId/prop-desc.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-get-temporal.zoneddatetime.prototype.calendar -description: The "calendar" property of Temporal.ZonedDateTime.prototype +esid: sec-get-temporal.zoneddatetime.prototype.calendarid +description: The "calendarId" property of Temporal.ZonedDateTime.prototype features: [Temporal] ---*/ -const descriptor = Object.getOwnPropertyDescriptor(Temporal.ZonedDateTime.prototype, "calendar"); +const descriptor = Object.getOwnPropertyDescriptor(Temporal.ZonedDateTime.prototype, "calendarId"); assert.sameValue(typeof descriptor.get, "function"); assert.sameValue(descriptor.set, undefined); assert.sameValue(descriptor.enumerable, false); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/branding.js new file mode 100644 index 0000000000..3dfefde3bf --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/branding.js @@ -0,0 +1,22 @@ +// 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.zoneddatetime.prototype.getcalendar +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getCalendar = Temporal.ZonedDateTime.prototype.getCalendar; + +assert.sameValue(typeof getCalendar, "function"); + +assert.throws(TypeError, () => getCalendar.call(undefined), "undefined"); +assert.throws(TypeError, () => getCalendar.call(null), "null"); +assert.throws(TypeError, () => getCalendar.call(true), "true"); +assert.throws(TypeError, () => getCalendar.call(""), "empty string"); +assert.throws(TypeError, () => getCalendar.call(Symbol()), "symbol"); +assert.throws(TypeError, () => getCalendar.call(1), "1"); +assert.throws(TypeError, () => getCalendar.call({}), "plain object"); +assert.throws(TypeError, () => getCalendar.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime"); +assert.throws(TypeError, () => getCalendar.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/builtin.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/builtin.js new file mode 100644 index 0000000000..65be1d8c8f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/builtin.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.getcalendar +description: > + Tests that Temporal.ZonedDateTime.prototype.getCalendar + meets the requirements for built-in objects defined by the + introduction of chapter 17 of the ECMAScript Language Specification. +info: | + Built-in functions that are not constructors do not have a "prototype" property unless + otherwise specified in the description of a particular function. + + Unless specified otherwise, a built-in object that is callable as a function is a built-in + function object with the characteristics described in 10.3. Unless specified otherwise, the + [[Extensible]] internal slot of a built-in object initially has the value true. + + Unless otherwise specified every built-in function and every built-in constructor has the + Function prototype object [...] as the value of its [[Prototype]] internal slot. +features: [Temporal] +---*/ + +assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.getCalendar), + true, "Built-in objects must be extensible."); + +assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.getCalendar), + "[object Function]", "Object.prototype.toString"); + +assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.getCalendar), + Function.prototype, "prototype"); + +assert.sameValue(Temporal.ZonedDateTime.prototype.getCalendar.hasOwnProperty("prototype"), + false, "prototype property"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/length.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/length.js new file mode 100644 index 0000000000..2fb3cc1ba7 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/length.js @@ -0,0 +1,25 @@ +// 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.zoneddatetime.prototype.getcalendar +description: Temporal.ZonedDateTime.prototype.getCalendar.length is 0 +info: | + Every built-in function object, including constructors, has a "length" property whose value is + an integer. Unless otherwise specified, this value is equal to the largest number of named + arguments shown in the subclause headings for the function description. Optional parameters + (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form + «...name») are not included in the default argument count. + + Unless otherwise specified, the "length" property of a built-in function object has the + attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.ZonedDateTime.prototype.getCalendar, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/name.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/name.js new file mode 100644 index 0000000000..ad36366603 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.getcalendar +description: Temporal.ZonedDateTime.prototype.getCalendar.name is "getCalendar". +info: | + Every built-in function object, including constructors, that is not identified as an anonymous + function has a "name" property whose value is a String. Unless otherwise specified, this value + is the name that is given to the function in this specification. + + Unless otherwise specified, the "name" property of a built-in function object, if it exists, + has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +verifyProperty(Temporal.ZonedDateTime.prototype.getCalendar, "name", { + value: "getCalendar", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/not-a-constructor.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/not-a-constructor.js new file mode 100644 index 0000000000..2f7c96899f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/not-a-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.getcalendar +description: > + Temporal.ZonedDateTime.prototype.getCalendar does not implement [[Construct]], is not new-able +info: | + Built-in function objects that are not identified as constructors do not implement the + [[Construct]] internal method unless otherwise specified in the description of a particular + function. +includes: [isConstructor.js] +features: [Reflect.construct, Temporal] +---*/ + +assert.throws(TypeError, () => { + new Temporal.ZonedDateTime.prototype.getCalendar(); +}, "Calling as constructor"); + +assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.getCalendar), false, + "isConstructor(Temporal.ZonedDateTime.prototype.getCalendar)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/prop-desc.js new file mode 100644 index 0000000000..a6346fbccf --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getCalendar/prop-desc.js @@ -0,0 +1,21 @@ +// 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.zoneddatetime.prototype.getcalendar +description: The "getCalendar" property of Temporal.ZonedDateTime.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.ZonedDateTime.prototype.getCalendar, + "function", + "`typeof ZonedDateTime.prototype.getCalendar` is `function`" +); + +verifyProperty(Temporal.ZonedDateTime.prototype, "getCalendar", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-names.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-names.js index 150e8dd11d..6145f65d19 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-names.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-names.js @@ -20,5 +20,5 @@ assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); assert.sameValue(result.offset, "+00:00", "offset result"); -assert.sameValue(result.calendar.id, "iso8601", "calendar result"); +assert.sameValue(result.calendar, "iso8601", "calendar result"); assert.sameValue(result.timeZone.id, "UTC", "timeZone result"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js index 3320cdc5a8..ab622d768d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { const arg = "iSo8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "iso8601", "Calendar is case-insensitive"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js index 0a299d540f..d72dcd303e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js @@ -12,7 +12,7 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { const arg = 19761118; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", "19761118 is a valid ISO string for Calendar"); +assert.sameValue(result.calendarId, "iso8601", "19761118 is a valid ISO string for Calendar"); const numbers = [ 1, diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js index 29e229cc10..7597e4de38 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js @@ -12,7 +12,7 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { let arg = "2016-12-31T23:59:60"; const result1 = instance.withCalendar(arg); assert.sameValue( - result1.calendar.id, + result1.calendarId, "iso8601", "leap second is a valid ISO string for Calendar" ); @@ -20,7 +20,7 @@ assert.sameValue( arg = { calendar: "2016-12-31T23:59:60" }; const result2 = instance.withCalendar(arg); assert.sameValue( - result2.calendar.id, + result2.calendarId, "iso8601", "leap second is a valid ISO string for Calendar (nested property)" ); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js index 83b7743d84..ddf6b9a220 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js index 347a4282e9..c06a99040b 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -33,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); const result = instance.withCalendar(arg); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js index f044a122de..b032fa8ed6 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js @@ -31,6 +31,6 @@ TemporalHelpers.checkSubclassingIgnored( assert.sameValue(result.millisecond, 0, "millisecond result"); assert.sameValue(result.microsecond, 0, "microsecond result"); assert.sameValue(result.nanosecond, 10, "nanosecond result"); - assert.sameValue(result.calendar, customCalendar, "calendar result"); + assert.sameValue(result.getCalendar(), customCalendar, "calendar result"); }, ); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-temporal-object.js index a7423b74a8..f4acd3a39e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-temporal-object.js @@ -24,5 +24,5 @@ TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject, calendar) => { const datetime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); // the PlainDate's calendar will override the ZonedDateTime's ISO calendar const result = datetime.withPlainDate({ year: 2001, month: 6, day: 4, calendar: temporalObject }); - assert.sameValue(result.calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.getCalendar(), calendar, "Temporal object coerced to calendar"); }); diff --git a/test/intl402/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js b/test/intl402/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js index a5639d8e4e..bc67df9456 100644 --- a/test/intl402/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js +++ b/test/intl402/Temporal/Calendar/prototype/dateFromFields/order-of-operations.js @@ -72,5 +72,5 @@ const arg2 = new Proxy(options, { const result = instance.dateFromFields(arg1, arg2); TemporalHelpers.assertPlainDate(result, 1, 1, "M01", 1, "date result", "ce", 1); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "gregory", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/intl402/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js b/test/intl402/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js index 2c39686e3d..1dd4fe9eaa 100644 --- a/test/intl402/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js +++ b/test/intl402/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations.js @@ -72,5 +72,5 @@ const arg2 = new Proxy(options, { const result = instance.monthDayFromFields(arg1, arg2); TemporalHelpers.assertPlainMonthDay(result, "M01", 1, "monthDay result"); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "gregory", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js b/test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js index ad3129730a..48d7390b2e 100644 --- a/test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js +++ b/test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations.js @@ -68,5 +68,5 @@ const arg2 = new Proxy(options, { const result = instance.yearMonthFromFields(arg1, arg2); TemporalHelpers.assertPlainYearMonth(result, 1, 1, "M01", "yearMonth result", "ce", 1); -assert.sameValue(result.calendar, instance, "calendar result"); +assert.sameValue(result.getISOFields().calendar, "gregory", "calendar slot should store a string"); assert.compareArray(actual, expected, "order of operations"); diff --git a/test/intl402/Temporal/Now/plainDate/calendar-string.js b/test/intl402/Temporal/Now/plainDate/calendar-string.js index e1cfa7fb14..4fcb572617 100644 --- a/test/intl402/Temporal/Now/plainDate/calendar-string.js +++ b/test/intl402/Temporal/Now/plainDate/calendar-string.js @@ -9,4 +9,4 @@ features: [Temporal] const date = Temporal.Now.plainDate("gregory"); assert(date instanceof Temporal.PlainDate); -assert.sameValue(date.calendar.id, "gregory"); +assert.sameValue(date.calendarId, "gregory"); diff --git a/test/intl402/Temporal/Now/plainDateTime/calendar-string.js b/test/intl402/Temporal/Now/plainDateTime/calendar-string.js index aa1ff27ba0..6cfce86d54 100644 --- a/test/intl402/Temporal/Now/plainDateTime/calendar-string.js +++ b/test/intl402/Temporal/Now/plainDateTime/calendar-string.js @@ -9,4 +9,4 @@ features: [Temporal] const dt = Temporal.Now.plainDateTime("gregory"); assert(dt instanceof Temporal.PlainDateTime); -assert.sameValue(dt.calendar.id, "gregory"); +assert.sameValue(dt.calendarId, "gregory"); diff --git a/test/intl402/Temporal/Now/zonedDateTime/calendar-string.js b/test/intl402/Temporal/Now/zonedDateTime/calendar-string.js index d729bddff8..6844490d92 100644 --- a/test/intl402/Temporal/Now/zonedDateTime/calendar-string.js +++ b/test/intl402/Temporal/Now/zonedDateTime/calendar-string.js @@ -10,8 +10,6 @@ features: [Temporal] const zdt = Temporal.Now.zonedDateTime("gregory"); const tz = Temporal.Now.timeZoneId(); assert(zdt instanceof Temporal.ZonedDateTime); -assert(zdt.calendar instanceof Temporal.Calendar); -assert.sameValue(zdt.calendar.id, "gregory"); +assert.sameValue(zdt.calendarId, "gregory"); assert(zdt.timeZone instanceof Temporal.TimeZone); assert.sameValue(zdt.timeZone.id, tz); - diff --git a/test/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js b/test/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js index 98be7bc03c..adde74db10 100644 --- a/test/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js +++ b/test/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js @@ -9,7 +9,6 @@ features: [Temporal] const zdt = Temporal.Now.zonedDateTime("gregory", "America/Los_Angeles"); assert(zdt instanceof Temporal.ZonedDateTime); -assert(zdt.calendar instanceof Temporal.Calendar); -assert.sameValue(zdt.calendar.id, "gregory"); +assert.sameValue(zdt.calendarId, "gregory"); assert(zdt.timeZone instanceof Temporal.TimeZone); assert.sameValue(zdt.timeZone.id, "America/Los_Angeles"); diff --git a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js index 2c458a8019..65c4147baf 100644 --- a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js +++ b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js @@ -9,7 +9,6 @@ features: [Temporal] const zdt = Temporal.Now.zonedDateTimeISO("America/Los_Angeles"); assert(zdt instanceof Temporal.ZonedDateTime); -assert(zdt.calendar instanceof Temporal.Calendar); -assert.sameValue(zdt.calendar.id, "iso8601"); +assert.sameValue(zdt.calendarId, "iso8601"); assert(zdt.timeZone instanceof Temporal.TimeZone); assert.sameValue(zdt.timeZone.id, "America/Los_Angeles"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js index 118282b48d..b78a7fcf87 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js @@ -19,7 +19,7 @@ const cal = { day() { return 6; } }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0); -assert.sameValue(pdt.calendar.toString(), "iso8601", "PlainDateTime with ISO calendar"); +assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar"); const pd = new Temporal.PlainDate(2010, 11, 12, cal); const shifted = pdt.withPlainDate(pd); @@ -32,7 +32,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is changed if receiver has ISO calendar (2)" ); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js index 2849905981..7145442005 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js @@ -34,7 +34,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal2, "calendar is changed with same id (2)" ); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js index f963a3b61d..d82e2b9444 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js @@ -35,7 +35,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged with same calendars (2)" ); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js index ad9f56f7bb..75ed9c3892 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js @@ -20,7 +20,7 @@ const cal = { }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12); -assert.sameValue(pd.calendar.toString(), "iso8601", "PlainDate with ISO calendar"); +assert.sameValue(pd.calendarId, "iso8601", "PlainDate with ISO calendar"); const shifted = pdt.withPlainDate(pd); TemporalHelpers.assertPlainDateTime( @@ -32,7 +32,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged if input has ISO calendar (2)" ); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar.js index 2065751f71..d749f18012 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar.js @@ -14,12 +14,12 @@ const gregorypdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 123, 456, const result1 = isopdt.withPlainDate("2020-11-13[u-ca=gregory]"); TemporalHelpers.assertPlainDateTime(result1, 2020, 11, "M11", 13, 3, 24, 30, 123, 456, 789, "result1", "ce", 2020); -assert.sameValue(result1.calendar.toString(), "gregory", "non-ISO calendar in argument overrides ISO calendar in receiver"); +assert.sameValue(result1.calendarId, "gregory", "non-ISO calendar in argument overrides ISO calendar in receiver"); const result2 = gregorypdt.withPlainDate("2020-11-13[u-ca=iso8601]"); TemporalHelpers.assertPlainDateTime(result2, 2020, 11, "M11", 13, 3, 24, 30, 123, 456, 789, "result2", "ce", 2020); -assert.sameValue(result2.calendar.toString(), "gregory", "non-ISO calendar in receiver overrides ISO calendar in argument"); +assert.sameValue(result2.calendarId, "gregory", "non-ISO calendar in receiver overrides ISO calendar in argument"); assert.throws(RangeError, () => gregorypdt.withPlainDate("2020-11-13[u-ca=japanese]"), "throws if both `this` and `other` have a non-ISO calendar"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js index d86925d1b8..75b409856e 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js @@ -30,7 +30,7 @@ TemporalHelpers.assertPlainDateTime( ); assert.sameValue( - shifted.calendar, + shifted.getCalendar(), cal, "calendar is unchanged if input has ISO calendar (2)" ); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js index ef0fc6bb7a..c94489839a 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -11,4 +11,4 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { const arg = "jApAnEsE";; const result = instance.withCalendar(arg); -assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive"); +assert.sameValue(result.calendarId, "japanese", "Calendar is case-insensitive"); diff --git a/test/staging/Temporal/Regex/old/plaindate.js b/test/staging/Temporal/Regex/old/plaindate.js index 30c23a84f9..b726f0e0e7 100644 --- a/test/staging/Temporal/Regex/old/plaindate.js +++ b/test/staging/Temporal/Regex/old/plaindate.js @@ -13,7 +13,7 @@ function test(isoString, components) { assert.sameValue(date.year, y); assert.sameValue(date.month, m); assert.sameValue(date.day, d); - assert.sameValue(date.calendar.id, cid); + assert.sameValue(date.calendarId, cid); } function generateTest(dateTimeString, zoneString) { var components = [ diff --git a/test/staging/Temporal/Regex/old/plaindatetime.js b/test/staging/Temporal/Regex/old/plaindatetime.js index 5771476f8d..5526082d39 100644 --- a/test/staging/Temporal/Regex/old/plaindatetime.js +++ b/test/staging/Temporal/Regex/old/plaindatetime.js @@ -19,7 +19,7 @@ function test(isoString, components) { assert.sameValue(datetime.millisecond, ms); assert.sameValue(datetime.microsecond, µs); assert.sameValue(datetime.nanosecond, ns); - assert.sameValue(datetime.calendar.id, cid); + assert.sameValue(datetime.calendarId, cid); } function generateTest(dateTimeString, zoneString) { var components = [ @@ -38,7 +38,7 @@ function generateTest(dateTimeString, zoneString) { test(`${ dateTimeString }:30.123456789${ zoneString }`, components); } -//valid strings +//valid strings [ "+0100[Europe/Vienna]", "+01:00[Europe/Vienna]", diff --git a/test/staging/Temporal/Regex/old/plainmonthday.js b/test/staging/Temporal/Regex/old/plainmonthday.js index 6623d912ca..e68ef73c56 100644 --- a/test/staging/Temporal/Regex/old/plainmonthday.js +++ b/test/staging/Temporal/Regex/old/plainmonthday.js @@ -12,7 +12,7 @@ function test(isoString, components) { var monthDay = Temporal.PlainMonthDay.from(isoString); assert.sameValue(monthDay.monthCode, `M${ m.toString().padStart(2, "0") }`); assert.sameValue(monthDay.day, d); - assert.sameValue(monthDay.calendar.id, cid); + assert.sameValue(monthDay.calendarId, cid); } function generateTest(dateTimeString, zoneString) { var components = [ diff --git a/test/staging/Temporal/Regex/old/plainyearmonth.js b/test/staging/Temporal/Regex/old/plainyearmonth.js index 1f34237d41..f6b1927c56 100644 --- a/test/staging/Temporal/Regex/old/plainyearmonth.js +++ b/test/staging/Temporal/Regex/old/plainyearmonth.js @@ -12,7 +12,7 @@ function test(isoString, components) { var yearMonth = Temporal.PlainYearMonth.from(isoString); assert.sameValue(yearMonth.year, y); assert.sameValue(yearMonth.month, m); - assert.sameValue(yearMonth.calendar.id, cid); + assert.sameValue(yearMonth.calendarId, cid); } function generateTest(dateTimeString, zoneString) { var components = [ diff --git a/test/staging/Temporal/UserCalendar/old/calendar-extra-fields.js b/test/staging/Temporal/UserCalendar/old/calendar-extra-fields.js index 2ef1262540..e594aaa45a 100644 --- a/test/staging/Temporal/UserCalendar/old/calendar-extra-fields.js +++ b/test/staging/Temporal/UserCalendar/old/calendar-extra-fields.js @@ -68,7 +68,7 @@ var monthday = new Temporal.PlainMonthDay(9, 15, calendar); var zoned = new Temporal.ZonedDateTime(1568505600000000000n, "UTC", calendar); var propDesc = { get() { - return this.calendar.season(this); + return this.getCalendar().season(this); }, configurable: true }; diff --git a/test/staging/Temporal/UserCalendar/old/calendar-non-trivial-mergefields.js b/test/staging/Temporal/UserCalendar/old/calendar-non-trivial-mergefields.js index f4262c66b4..0a93ec7f95 100644 --- a/test/staging/Temporal/UserCalendar/old/calendar-non-trivial-mergefields.js +++ b/test/staging/Temporal/UserCalendar/old/calendar-non-trivial-mergefields.js @@ -92,13 +92,13 @@ var zoned = new Temporal.ZonedDateTime(1568505600000000000n, "UTC", calendar); var propDesc = { century: { get() { - return this.calendar.century(this); + return this.getCalendar().century(this); }, configurable: true }, centuryYear: { get() { - return this.calendar.centuryYear(this); + return this.getCalendar().centuryYear(this); }, configurable: true } diff --git a/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js b/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js index 21a3d2ab43..f582ca8431 100644 --- a/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js +++ b/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js @@ -188,12 +188,12 @@ assert.sameValue(md2.monthCode, "M01"); var tz = Temporal.TimeZone.from("UTC"); var inst = Temporal.Instant.fromEpochSeconds(0); var dt = tz.getPlainDateTimeFor(inst, obj); -assert.sameValue(dt.calendar.id, obj.id); +assert.sameValue(dt.getCalendar(), obj); // Temporal.Now.plainDateTime() var nowDateTime = Temporal.Now.plainDateTime(obj, "UTC"); -assert.sameValue(nowDateTime.calendar.id, obj.id); +assert.sameValue(nowDateTime.getCalendar(), obj); // Temporal.Now.plainDate() var nowDate = Temporal.Now.plainDate(obj, "UTC"); -assert.sameValue(nowDate.calendar.id, obj.id); +assert.sameValue(nowDate.getCalendar(), obj); diff --git a/test/staging/Temporal/UserCalendar/old/trivial-subclass.js b/test/staging/Temporal/UserCalendar/old/trivial-subclass.js index 32703b7010..2af5794955 100644 --- a/test/staging/Temporal/UserCalendar/old/trivial-subclass.js +++ b/test/staging/Temporal/UserCalendar/old/trivial-subclass.js @@ -151,12 +151,12 @@ assert.sameValue(md2.monthCode, "M02"); var tz = Temporal.TimeZone.from("UTC"); var instant = Temporal.Instant.fromEpochSeconds(0); var dt = tz.getPlainDateTimeFor(instant, obj); -assert.sameValue(dt.calendar.id, obj.id); +assert.sameValue(dt.getCalendar(), obj); // Temporal.Now.plainDateTime() var nowDateTime = Temporal.Now.plainDateTime(obj, "UTC"); -assert.sameValue(nowDateTime.calendar.id, obj.id); +assert.sameValue(nowDateTime.getCalendar(), obj); // Temporal.Now.plainDate() var nowDate = Temporal.Now.plainDate(obj, "UTC"); -assert.sameValue(nowDate.calendar.id, obj.id); +assert.sameValue(nowDate.getCalendar(), obj); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js index 4c465aebcb..f0b5480691 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js @@ -19,4 +19,4 @@ var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTim timeZone: tz, calendar: fakeGregorian }); -assert.sameValue(zdt.toPlainDate().calendar, fakeGregorian); +assert.sameValue(zdt.toPlainDate().getCalendar(), fakeGregorian); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js b/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js index 9ae4f4e2f0..c25f146f4a 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js @@ -29,4 +29,4 @@ var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTim timeZone: tz, calendar: fakeGregorian }); -assert.sameValue(zdt.toPlainMonthDay().calendar, fakeGregorian); +assert.sameValue(zdt.toPlainMonthDay().getCalendar(), fakeGregorian); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js b/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js index 9985d0d09f..09f1720390 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js @@ -29,4 +29,4 @@ var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTim timeZone: tz, calendar: fakeGregorian }); -assert.sameValue(zdt.toPlainYearMonth().calendar, fakeGregorian); +assert.sameValue(zdt.toPlainYearMonth().getCalendar(), fakeGregorian); diff --git a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js index 4abf5568d2..3abd2a0aab 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js +++ b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js @@ -17,5 +17,5 @@ assert.sameValue(`${ zdt.withCalendar(cal) }`, "2019-11-18T15:23:30.123456789-08 var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00][u-ca=iso8601]"); var zdt2 = zdt.withCalendar(cal); assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds); -assert.sameValue(zdt2.calendar, cal); +assert.sameValue(zdt2.getCalendar(), cal); assert.sameValue(zdt2.timeZone.id, "+01:00"); diff --git a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js index 56b7c54cf1..8effe38a75 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js +++ b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js @@ -12,6 +12,6 @@ var fakeGregorian = { toString() { return "gregory"; }}; var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00]").withCalendar(fakeGregorian); var zdt2 = zdt.withTimeZone("-08:00"); assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds); -assert.sameValue(zdt2.calendar, fakeGregorian); +assert.sameValue(zdt2.getCalendar(), fakeGregorian); assert.sameValue(zdt2.timeZone.id, "-08:00"); assert.notSameValue(`${ zdt.toPlainDateTime() }`, `${ zdt2.toPlainDateTime() }`);