2019-04-10 17:09:40 +02:00
|
|
|
// Copyright 2018 Igalia, S.L. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
2023-08-07 17:01:48 +02:00
|
|
|
esid: sec-createdatetimeformat
|
2019-04-10 17:09:40 +02:00
|
|
|
description: Checks the propagation of exceptions from the options for the DateTimeFormat constructor.
|
|
|
|
features: [Intl.DateTimeFormat-datetimestyle]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
// To be merged into constructor-options-throwing-getters.js when the feature is removed.
|
|
|
|
|
|
|
|
function CustomError() {}
|
|
|
|
|
|
|
|
const options = [
|
2023-08-07 17:01:48 +02:00
|
|
|
// CreateDateTimeFormat step 39
|
2019-04-10 17:09:40 +02:00
|
|
|
"dateStyle",
|
2023-08-07 17:01:48 +02:00
|
|
|
// CreateDateTimeFormat step 41
|
2019-04-10 17:09:40 +02:00
|
|
|
"timeStyle",
|
|
|
|
];
|
|
|
|
|
|
|
|
for (const option of options) {
|
|
|
|
assert.throws(CustomError, () => {
|
|
|
|
new Intl.DateTimeFormat("en", {
|
|
|
|
get [option]() {
|
|
|
|
throw new CustomError();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, `Exception from ${option} getter should be propagated`);
|
|
|
|
}
|