-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporal: Test observable calendar.mergeFields() calls with null-prot…
…otype objects As of tc39/proposal-temporal#2219 the arguments to the calendar.mergeFields() methods should be null-prototype objects when called from with() and toPlainDate() methods. This adds tests for that behaviour.
- Loading branch information
Showing
8 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...mporal/PlainDate/prototype/with/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plaindate.prototype.with | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainDate(2000, 5, 2, calendar); | ||
instance.with({ day: 24 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...al/PlainDateTime/prototype/with/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plaindatetime.prototype.with | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); | ||
instance.with({ day: 24 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...nMonthDay/prototype/toPlainDate/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plainmonthday.prototype.toplaindate | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainMonthDay(5, 2, calendar); | ||
instance.toPlainDate({ year: 2019 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...al/PlainMonthDay/prototype/with/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plainmonthday.prototype.with | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainMonthDay(5, 2, calendar); | ||
instance.with({ day: 24 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...YearMonth/prototype/toPlainDate/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plainyearmonth.prototype.toplaindate | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar); | ||
instance.toPlainDate({ day: 24 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...l/PlainYearMonth/prototype/with/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.plainyearmonth.prototype.with | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar); | ||
instance.with({ year: 2019 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |
15 changes: 15 additions & 0 deletions
15
...al/ZonedDateTime/prototype/with/calendar-mergefields-called-with-null-prototype-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.prototype.with | ||
description: > | ||
Calendar.mergeFields method is called with null-prototype fields objects | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = TemporalHelpers.calendarCheckMergeFieldsPrototypePollution(); | ||
const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar); | ||
instance.with({ day: 24 }); | ||
assert.sameValue(calendar.mergeFieldsCallCount, 1, "mergeFields should have been called on the calendar"); |