diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-offset-not-agreeing-with-timezone.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-offset-not-agreeing-with-timezone.js new file mode 100644 index 0000000000..79f6346c1f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-offset-not-agreeing-with-timezone.js @@ -0,0 +1,15 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: Property bag with offset property is rejected if offset does not agree with time zone +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("+01:00"); +const datetime = new Temporal.ZonedDateTime(0n, timeZone); + +const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone }; +assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(properties, datetime), "offset property not matching time zone is rejected (first argument)"); +assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(datetime, properties), "offset property not matching time zone is rejected (second argument)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-offset-not-agreeing-with-timezone.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-offset-not-agreeing-with-timezone.js new file mode 100644 index 0000000000..4bce6c887d --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-offset-not-agreeing-with-timezone.js @@ -0,0 +1,13 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: Property bag with offset property is rejected if offset does not agree with time zone +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("+01:00"); + +const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone }; +assert.throws(RangeError, () => Temporal.ZonedDateTime.from(properties), "offset property not matching time zone is rejected"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-offset-not-agreeing-with-timezone.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-offset-not-agreeing-with-timezone.js new file mode 100644 index 0000000000..2605577967 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-offset-not-agreeing-with-timezone.js @@ -0,0 +1,14 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: Property bag with offset property is rejected if offset does not agree with time zone +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("+01:00"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone }; +assert.throws(RangeError, () => instance.equals(properties), "offset property not matching time zone is rejected"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-offset-not-agreeing-with-timezone.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-offset-not-agreeing-with-timezone.js new file mode 100644 index 0000000000..e7c2b3fe33 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-offset-not-agreeing-with-timezone.js @@ -0,0 +1,14 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: Property bag with offset property is rejected if offset does not agree with time zone +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("+01:00"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone }; +assert.throws(RangeError, () => instance.since(properties), "offset property not matching time zone is rejected"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-offset-not-agreeing-with-timezone.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-offset-not-agreeing-with-timezone.js new file mode 100644 index 0000000000..1895808b8c --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-offset-not-agreeing-with-timezone.js @@ -0,0 +1,14 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: Property bag with offset property is rejected if offset does not agree with time zone +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("+01:00"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const properties = { year: 2021, month: 10, day: 28, offset: "-07:00", timeZone }; +assert.throws(RangeError, () => instance.until(properties), "offset property not matching time zone is rejected");