2023-03-03 02:19:24 +01:00
|
|
|
// Copyright (C) 2023 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: options properties are extracted with string argument.
|
|
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
|
|
features: [Temporal]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
const expected = [
|
|
|
|
"get options.disambiguation",
|
|
|
|
"get options.disambiguation.toString",
|
|
|
|
"call options.disambiguation.toString",
|
2024-06-04 13:17:54 +02:00
|
|
|
"get options.offset",
|
2023-03-03 02:19:24 +01:00
|
|
|
"get options.offset.toString",
|
|
|
|
"call options.offset.toString",
|
2024-06-04 13:17:54 +02:00
|
|
|
"get options.overflow",
|
2023-03-03 02:19:24 +01:00
|
|
|
"get options.overflow.toString",
|
|
|
|
"call options.overflow.toString",
|
|
|
|
];
|
|
|
|
|
|
|
|
let actual = [];
|
|
|
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
|
|
|
disambiguation: "compatible",
|
|
|
|
offset: "ignore",
|
|
|
|
overflow: "reject",
|
|
|
|
}, "options");
|
|
|
|
|
|
|
|
const result = Temporal.ZonedDateTime.from("2001-09-09T01:46:40+00:00[UTC]", options);
|
|
|
|
assert.compareArray(actual, expected, "Successful call");
|
|
|
|
assert.sameValue(result.epochNanoseconds, 1_000_000_000_000_000_000n);
|
|
|
|
|
|
|
|
actual.splice(0); // empty it for the next check
|
2024-06-04 13:17:54 +02:00
|
|
|
|
2023-03-03 02:19:24 +01:00
|
|
|
assert.throws(TypeError, () => Temporal.ZonedDateTime.from(7, options));
|
2024-06-04 13:17:54 +02:00
|
|
|
assert.compareArray(actual, expected, "Failing call");
|