-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When calendars are added, getters will return the calendar fields, but we want to use the internal ISO 8601-valued slots. Dates are before, after, or equal to other dates regardless of which calendar system is used.
- Loading branch information
Showing
8 changed files
with
140 additions
and
20 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
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
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
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
24 changes: 24 additions & 0 deletions
24
polyfill/test/Date/constructor/compare/use-internal-slots.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,24 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal-comparetemporaldate | ||
---*/ | ||
|
||
function CustomError() {} | ||
|
||
class AvoidGettersDate extends Temporal.Date { | ||
get year() { | ||
throw new CustomError(); | ||
} | ||
get month() { | ||
throw new CustomError(); | ||
} | ||
get day() { | ||
throw new CustomError(); | ||
} | ||
} | ||
|
||
const one = new AvoidGettersDate(2000, 5, 2); | ||
const two = new AvoidGettersDate(2006, 3, 25); | ||
assert.sameValue(Temporal.Date.compare(one, two), -1); |
42 changes: 42 additions & 0 deletions
42
polyfill/test/DateTime/constructor/compare/use-internal-slots.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,42 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal-comparetemporaldatetime | ||
---*/ | ||
|
||
function CustomError() {} | ||
|
||
class AvoidGettersDateTime extends Temporal.DateTime { | ||
get year() { | ||
throw new CustomError(); | ||
} | ||
get month() { | ||
throw new CustomError(); | ||
} | ||
get day() { | ||
throw new CustomError(); | ||
} | ||
get hour() { | ||
throw new CustomError(); | ||
} | ||
get minute() { | ||
throw new CustomError(); | ||
} | ||
get second() { | ||
throw new CustomError(); | ||
} | ||
get millisecond() { | ||
throw new CustomError(); | ||
} | ||
get microsecond() { | ||
throw new CustomError(); | ||
} | ||
get nanosecond() { | ||
throw new CustomError(); | ||
} | ||
} | ||
|
||
const one = new AvoidGettersDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); | ||
const two = new AvoidGettersDateTime(2006, 3, 25, 6, 54, 32, 123, 456, 789); | ||
assert.sameValue(Temporal.DateTime.compare(one, two), -1); |
33 changes: 33 additions & 0 deletions
33
polyfill/test/Time/constructor/compare/use-internal-slots.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,33 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal-comparetemporaltime | ||
---*/ | ||
|
||
function CustomError() {} | ||
|
||
class AvoidGettersTime extends Temporal.Time { | ||
get hour() { | ||
throw new CustomError(); | ||
} | ||
get minute() { | ||
throw new CustomError(); | ||
} | ||
get second() { | ||
throw new CustomError(); | ||
} | ||
get millisecond() { | ||
throw new CustomError(); | ||
} | ||
get microsecond() { | ||
throw new CustomError(); | ||
} | ||
get nanosecond() { | ||
throw new CustomError(); | ||
} | ||
} | ||
|
||
const one = new AvoidGettersTime(12, 34, 56, 987, 654, 321); | ||
const two = new AvoidGettersTime(6, 54, 32, 123, 456, 789); | ||
assert.sameValue(Temporal.Time.compare(one, two), 1); |
21 changes: 21 additions & 0 deletions
21
polyfill/test/YearMonth/constructor/compare/use-internal-slots.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,21 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal-comparetemporalyearmonth | ||
---*/ | ||
|
||
function CustomError() {} | ||
|
||
class AvoidGettersYearMonth extends Temporal.YearMonth { | ||
get year() { | ||
throw new CustomError(); | ||
} | ||
get month() { | ||
throw new CustomError(); | ||
} | ||
} | ||
|
||
const one = new AvoidGettersYearMonth(2000, 5); | ||
const two = new AvoidGettersYearMonth(2006, 3); | ||
assert.sameValue(Temporal.YearMonth.compare(one, two), -1); |