mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 21:14:45 +02:00
Temporal: Remove tests for getISOFields methods
This commit is contained in:
parent
e5ef51ba7e
commit
7e4de57437
@ -1,22 +0,0 @@
|
|||||||
// 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.plaindate.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.PlainDate.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainDate), "Temporal.PlainDate");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainDate.prototype), "Temporal.PlainDate.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.PlainDate.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.PlainDate.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.PlainDate.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.PlainDate.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.PlainDate.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
|
|
||||||
const result = date.getISOFields();
|
|
||||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
|
||||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
|
||||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
|
||||||
assert.sameValue(result.calendar, "iso8601", "calendar result");
|
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
const result = date.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
const result = date.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// 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.plaindate.prototype.getisofields
|
|
||||||
description: Temporal.PlainDate.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDate.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: Temporal.PlainDate.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDate.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindate.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.PlainDate.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.PlainDate.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.PlainDate.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.PlainDate.prototype.getISOFields)");
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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.plaindate.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.PlainDate.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.PlainDate.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof PlainDate.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDate.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
@ -1,22 +0,0 @@
|
|||||||
// 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.plaindatetime.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.PlainDateTime.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainDateTime), "Temporal.PlainDateTime");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.PlainDateTime.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.PlainDateTime.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.PlainDateTime.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.PlainDateTime.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.PlainDateTime.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
|
||||||
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
|
||||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
|
||||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
|
||||||
assert.sameValue(result.isoHour, 12, "isoHour result");
|
|
||||||
assert.sameValue(result.isoMinute, 34, "isoMinute result");
|
|
||||||
assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
|
||||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
|
||||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
|
||||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
|
||||||
assert.sameValue(result.calendar, "iso8601", "calendar result");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoMonth",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoMonth",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// 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.plaindatetime.prototype.getisofields
|
|
||||||
description: Temporal.PlainDateTime.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDateTime.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: Temporal.PlainDateTime.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDateTime.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.PlainDateTime.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.PlainDateTime.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.PlainDateTime.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.PlainDateTime.prototype.getISOFields)");
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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.plaindatetime.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.PlainDateTime.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.PlainDateTime.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof PlainDateTime.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainDateTime.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
@ -1,22 +0,0 @@
|
|||||||
// 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.plainmonthday.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.PlainMonthDay.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainMonthDay), "Temporal.PlainMonthDay");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainMonthDay.prototype), "Temporal.PlainMonthDay.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.PlainMonthDay.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.PlainMonthDay.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.PlainMonthDay.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.PlainMonthDay.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.PlainMonthDay.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const md = new Temporal.PlainMonthDay(5, 2);
|
|
||||||
|
|
||||||
const result = md.getISOFields();
|
|
||||||
assert.sameValue(result.isoYear, 1972, "isoYear result");
|
|
||||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
|
||||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
|
||||||
assert.sameValue(result.calendar, "iso8601", "calendar result");
|
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const md = new Temporal.PlainMonthDay(5, 2);
|
|
||||||
const result = md.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const md = new Temporal.PlainMonthDay(5, 2);
|
|
||||||
const result = md.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// 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.plainmonthday.prototype.getisofields
|
|
||||||
description: Temporal.PlainMonthDay.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainMonthDay.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: Temporal.PlainMonthDay.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainMonthDay.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.PlainMonthDay.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.PlainMonthDay.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.PlainMonthDay.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.PlainMonthDay.prototype.getISOFields)");
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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.plainmonthday.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.PlainMonthDay.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.PlainMonthDay.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof PlainMonthDay.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainMonthDay.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.PlainTime.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainTime), "Temporal.PlainTime");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainTime.prototype), "Temporal.PlainTime.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.PlainTime.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.PlainTime.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.PlainTime.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.PlainTime.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.PlainTime.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,18 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
|
|
||||||
const result = time.getISOFields();
|
|
||||||
assert.sameValue(result.isoHour, 12, "isoHour result");
|
|
||||||
assert.sameValue(result.isoMinute, 34, "isoMinute result");
|
|
||||||
assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
|
||||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
|
||||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
|
||||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
];
|
|
||||||
|
|
||||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const result = time.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
];
|
|
||||||
|
|
||||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const result = time.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Temporal.PlainTime.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainTime.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: Temporal.PlainTime.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainTime.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.PlainTime.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.PlainTime.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.PlainTime.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.PlainTime.prototype.getISOFields)");
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plaintime.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.PlainTime.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.PlainTime.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof PlainTime.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainTime.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.plaintime.prototype.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
@ -1,22 +0,0 @@
|
|||||||
// 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.plainyearmonth.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.PlainYearMonth.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainYearMonth), "Temporal.PlainYearMonth");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.PlainYearMonth.prototype), "Temporal.PlainYearMonth.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.PlainYearMonth.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.PlainYearMonth.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.PlainYearMonth.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.PlainYearMonth.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.PlainYearMonth.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const ym = new Temporal.PlainYearMonth(2000, 5);
|
|
||||||
|
|
||||||
const result = ym.getISOFields();
|
|
||||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
|
||||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
|
||||||
assert.sameValue(result.isoDay, 1, "isoDay result");
|
|
||||||
assert.sameValue(result.calendar, "iso8601", "calendar result");
|
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const ym = new Temporal.PlainYearMonth(2000, 5);
|
|
||||||
const result = ym.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoMonth",
|
|
||||||
"isoYear",
|
|
||||||
];
|
|
||||||
|
|
||||||
const ym = new Temporal.PlainYearMonth(2000, 5);
|
|
||||||
const result = ym.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// 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.plainyearmonth.prototype.getisofields
|
|
||||||
description: Temporal.PlainYearMonth.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainYearMonth.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: Temporal.PlainYearMonth.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainYearMonth.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.PlainYearMonth.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.PlainYearMonth.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.PlainYearMonth.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.PlainYearMonth.prototype.getISOFields)");
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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.plainyearmonth.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.PlainYearMonth.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.PlainYearMonth.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof PlainYearMonth.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.PlainYearMonth.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Negative time fields are balanced upwards
|
|
||||||
info: |
|
|
||||||
sec-temporal-balancetime steps 3–14:
|
|
||||||
3. Set _microsecond_ to _microsecond_ + floor(_nanosecond_ / 1000).
|
|
||||||
4. Set _nanosecond_ to _nanosecond_ modulo 1000.
|
|
||||||
5. Set _millisecond_ to _millisecond_ + floor(_microsecond_ / 1000).
|
|
||||||
6. Set _microsecond_ to _microsecond_ modulo 1000.
|
|
||||||
7. Set _second_ to _second_ + floor(_millisecond_ / 1000).
|
|
||||||
8. Set _millisecond_ to _millisecond_ modulo 1000.
|
|
||||||
9. Set _minute_ to _minute_ + floor(_second_ / 60).
|
|
||||||
10. Set _second_ to _second_ modulo 60.
|
|
||||||
11. Set _hour_ to _hour_ + floor(_minute_ / 60).
|
|
||||||
12. Set _minute_ to _minute_ modulo 60.
|
|
||||||
13. Let _days_ be floor(_hour_ / 24).
|
|
||||||
14. Set _hour_ to _hour_ modulo 24.
|
|
||||||
sec-temporal-balanceisodatetime step 1:
|
|
||||||
1. Let _balancedTime_ be ? BalanceTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_).
|
|
||||||
sec-temporal-builtintimezonegetplaindatetimefor step 3:
|
|
||||||
3. Set _result_ to ? BalanceISODateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]] + _offsetNanoseconds_).
|
|
||||||
sec-get-temporal.zoneddatetime.prototype.getisofields step 7:
|
|
||||||
7. Let _dateTime_ be ? BuiltinTimeZoneGetPlainDateTimeFor(_timeZone_, _instant_, _calendar_).
|
|
||||||
includes: [temporalHelpers.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
// This code path is encountered if the time zone offset is negative and its
|
|
||||||
// absolute value in nanoseconds is greater than the nanosecond field of the
|
|
||||||
// ZonedDateTime
|
|
||||||
const datetime = new Temporal.ZonedDateTime(1001n, "-00:02");
|
|
||||||
|
|
||||||
const fields = datetime.getISOFields();
|
|
||||||
|
|
||||||
assert.sameValue(fields.isoHour, 23);
|
|
||||||
assert.sameValue(fields.isoMinute, 58);
|
|
||||||
assert.sameValue(fields.isoSecond, 0);
|
|
||||||
assert.sameValue(fields.isoMillisecond, 0);
|
|
||||||
assert.sameValue(fields.isoMicrosecond, 1);
|
|
||||||
assert.sameValue(fields.isoNanosecond, 1);
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Throw a TypeError if the receiver is invalid
|
|
||||||
features: [Symbol, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const getISOFields = Temporal.ZonedDateTime.prototype.getISOFields;
|
|
||||||
|
|
||||||
assert.sameValue(typeof getISOFields, "function");
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(undefined), "undefined");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(null), "null");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(true), "true");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(""), "empty string");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Symbol()), "symbol");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(1), "1");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call({}), "plain object");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime");
|
|
||||||
assert.throws(TypeError, () => getISOFields.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype");
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Tests that Temporal.ZonedDateTime.prototype.getISOFields
|
|
||||||
meets the requirements for built-in objects defined by the
|
|
||||||
introduction of chapter 17 of the ECMAScript Language Specification.
|
|
||||||
info: |
|
|
||||||
Built-in functions that are not constructors do not have a "prototype" property unless
|
|
||||||
otherwise specified in the description of a particular function.
|
|
||||||
|
|
||||||
Unless specified otherwise, a built-in object that is callable as a function is a built-in
|
|
||||||
function object with the characteristics described in 10.3. Unless specified otherwise, the
|
|
||||||
[[Extensible]] internal slot of a built-in object initially has the value true.
|
|
||||||
|
|
||||||
Unless otherwise specified every built-in function and every built-in constructor has the
|
|
||||||
Function prototype object [...] as the value of its [[Prototype]] internal slot.
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.getISOFields),
|
|
||||||
true, "Built-in objects must be extensible.");
|
|
||||||
|
|
||||||
assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.getISOFields),
|
|
||||||
"[object Function]", "Object.prototype.toString");
|
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.getISOFields),
|
|
||||||
Function.prototype, "prototype");
|
|
||||||
|
|
||||||
assert.sameValue(Temporal.ZonedDateTime.prototype.getISOFields.hasOwnProperty("prototype"),
|
|
||||||
false, "prototype property");
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Correct field names on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const datetime = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC");
|
|
||||||
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
assert.sameValue(result.isoYear, 2001, "isoYear result");
|
|
||||||
assert.sameValue(result.isoMonth, 9, "isoMonth result");
|
|
||||||
assert.sameValue(result.isoDay, 10, "isoDay result");
|
|
||||||
assert.sameValue(result.isoHour, 1, "isoHour result");
|
|
||||||
assert.sameValue(result.isoMinute, 46, "isoMinute result");
|
|
||||||
assert.sameValue(result.isoSecond, 40, "isoSecond result");
|
|
||||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
|
||||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
|
||||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
|
||||||
assert.sameValue(result.offset, "+00:00", "offset result");
|
|
||||||
assert.sameValue(result.calendar, "iso8601", "calendar result");
|
|
||||||
assert.sameValue(result.timeZone, "UTC", "timeZone result");
|
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Properties on the returned object have the correct descriptor
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoMonth",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
"isoYear",
|
|
||||||
"offset",
|
|
||||||
"timeZone",
|
|
||||||
];
|
|
||||||
|
|
||||||
const datetime = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC");
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
|
|
||||||
for (const property of expected) {
|
|
||||||
verifyProperty(result, property, {
|
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Properties added in correct order to object returned from getISOFields
|
|
||||||
includes: [compareArray.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const expected = [
|
|
||||||
"calendar",
|
|
||||||
"isoDay",
|
|
||||||
"isoHour",
|
|
||||||
"isoMicrosecond",
|
|
||||||
"isoMillisecond",
|
|
||||||
"isoMinute",
|
|
||||||
"isoMonth",
|
|
||||||
"isoNanosecond",
|
|
||||||
"isoSecond",
|
|
||||||
"isoYear",
|
|
||||||
"offset",
|
|
||||||
"timeZone",
|
|
||||||
];
|
|
||||||
|
|
||||||
const datetime = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC");
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
|
|
||||||
assert.compareArray(Object.keys(result), expected);
|
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Temporal.ZonedDateTime.prototype.getISOFields.length is 0
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, has a "length" property whose value is
|
|
||||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
|
||||||
arguments shown in the subclause headings for the function description. Optional parameters
|
|
||||||
(which are indicated with brackets: [ ]) or rest parameters (which are shown using the form
|
|
||||||
«...name») are not included in the default argument count.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "length" property of a built-in function object has the
|
|
||||||
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.ZonedDateTime.prototype.getISOFields, "length", {
|
|
||||||
value: 0,
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: Temporal.ZonedDateTime.prototype.getISOFields.name is "getISOFields".
|
|
||||||
info: |
|
|
||||||
Every built-in function object, including constructors, that is not identified as an anonymous
|
|
||||||
function has a "name" property whose value is a String. Unless otherwise specified, this value
|
|
||||||
is the name that is given to the function in this specification.
|
|
||||||
|
|
||||||
Unless otherwise specified, the "name" property of a built-in function object, if it exists,
|
|
||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
verifyProperty(Temporal.ZonedDateTime.prototype.getISOFields, "name", {
|
|
||||||
value: "getISOFields",
|
|
||||||
writable: false,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: A pre-epoch value is handled correctly by the modulo operation in GetISOPartsFromEpoch
|
|
||||||
info: |
|
|
||||||
sec-temporal-getisopartsfromepoch step 1:
|
|
||||||
1. Let _remainderNs_ be the mathematical value whose sign is the sign of _epochNanoseconds_ and whose magnitude is abs(_epochNanoseconds_) modulo 10<sup>6</sup>.
|
|
||||||
sec-temporal-builtintimezonegetplaindatetimefor step 2:
|
|
||||||
2. Let _result_ be ! GetISOPartsFromEpoch(_instant_.[[Nanoseconds]]).
|
|
||||||
features: [Temporal]
|
|
||||||
includes: [deepEqual.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const datetime = new Temporal.ZonedDateTime(-13849764_999_999_999n, "UTC");
|
|
||||||
|
|
||||||
// This code path shows up anywhere we convert an exact time, before the Unix
|
|
||||||
// epoch, with nonzero microseconds or nanoseconds, into a wall time.
|
|
||||||
|
|
||||||
const result = datetime.getISOFields();
|
|
||||||
assert.deepEqual(result, {
|
|
||||||
calendar: "iso8601",
|
|
||||||
isoDay: 24,
|
|
||||||
isoHour: 16,
|
|
||||||
isoMicrosecond: 0,
|
|
||||||
isoMillisecond: 0,
|
|
||||||
isoMinute: 50,
|
|
||||||
isoMonth: 7,
|
|
||||||
isoNanosecond: 1,
|
|
||||||
isoSecond: 35,
|
|
||||||
isoYear: 1969,
|
|
||||||
offset: "+00:00",
|
|
||||||
timeZone: "UTC"
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: >
|
|
||||||
Temporal.ZonedDateTime.prototype.getISOFields does not implement [[Construct]], is not new-able
|
|
||||||
info: |
|
|
||||||
Built-in function objects that are not identified as constructors do not implement the
|
|
||||||
[[Construct]] internal method unless otherwise specified in the description of a particular
|
|
||||||
function.
|
|
||||||
includes: [isConstructor.js]
|
|
||||||
features: [Reflect.construct, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
|
||||||
new Temporal.ZonedDateTime.prototype.getISOFields();
|
|
||||||
}, "Calling as constructor");
|
|
||||||
|
|
||||||
assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.getISOFields), false,
|
|
||||||
"isConstructor(Temporal.ZonedDateTime.prototype.getISOFields)");
|
|
@ -1,18 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: The offset property of returned object
|
|
||||||
features: [BigInt, Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function test(timeZoneIdentifier, expectedOffsetString, description) {
|
|
||||||
const datetime = new Temporal.ZonedDateTime(0n, timeZoneIdentifier);
|
|
||||||
const fields = datetime.getISOFields();
|
|
||||||
assert.sameValue(fields.offset, expectedOffsetString, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
test("UTC", "+00:00", "offset of UTC is +00:00");
|
|
||||||
test("+01:00", "+01:00", "positive offset");
|
|
||||||
test("-05:00", "-05:00", "negative offset");
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
|
||||||
description: The "getISOFields" property of Temporal.ZonedDateTime.prototype
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.sameValue(
|
|
||||||
typeof Temporal.ZonedDateTime.prototype.getISOFields,
|
|
||||||
"function",
|
|
||||||
"`typeof ZonedDateTime.prototype.getISOFields` is `function`"
|
|
||||||
);
|
|
||||||
|
|
||||||
verifyProperty(Temporal.ZonedDateTime.prototype, "getISOFields", {
|
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
// 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.getisofields
|
|
||||||
description: Correct prototype on the object returned from getISOFields
|
|
||||||
features: [Temporal]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const instance = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC");
|
|
||||||
const result = instance.getISOFields();
|
|
||||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
|
Loading…
x
Reference in New Issue
Block a user