blob: 9de556a653e31fd31510cff340b423ab6b68965a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// 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.calendar.prototype.yearmonthfromfields
description: Errors due to missing properties on fields object are thrown in the correct order
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
let getMonth = false;
let getMonthCode = false;
const missingYearAndMonth = {
get month() {
getMonth = true;
},
get monthCode() {
getMonthCode = true;
},
};
assert.throws(TypeError, () => instance.yearMonthFromFields(missingYearAndMonth), "year should be checked after fetching but before resolving the month");
assert(getMonth, "year is fetched after month");
assert(getMonthCode, "year is fetched after monthCode");
assert.throws(TypeError, () => instance.yearMonthFromFields({ year: 2000 }), "month should be resolved last");
reportCompare(0, 0);
|