mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Improve coverage for Intl Locale Info proposal
This commit is contained in:
parent
d19534c3ce
commit
347b651e95
@ -13,3 +13,4 @@ features: [Intl.Locale,Intl.Locale-info]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert(Array.isArray(new Intl.Locale('en').calendars));
|
assert(Array.isArray(new Intl.Locale('en').calendars));
|
||||||
|
assert(new Intl.Locale('en').calendars.length > 0, 'array has at least one element');
|
||||||
|
@ -18,6 +18,7 @@ features: [Intl.Locale,Intl.Locale-info]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const output = new Intl.Locale('en').collations;
|
const output = new Intl.Locale('en').collations;
|
||||||
|
assert(output.length > 0, 'array has at least one element');
|
||||||
output.forEach(c => {
|
output.forEach(c => {
|
||||||
if(['standard', 'search'].includes(c))
|
if(['standard', 'search'].includes(c))
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
|
@ -17,6 +17,7 @@ features: [Intl.Locale,Intl.Locale-info]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const output = new Intl.Locale('en').hourCycles;
|
const output = new Intl.Locale('en').hourCycles;
|
||||||
|
assert(output.length > 0, 'array has at least one element');
|
||||||
output.forEach(hc => {
|
output.forEach(hc => {
|
||||||
if(!['h11', 'h12', 'h23', 'h24'].includes(hc))
|
if(!['h11', 'h12', 'h23', 'h24'].includes(hc))
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
|
@ -13,3 +13,4 @@ features: [Intl.Locale,Intl.Locale-info]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert(Array.isArray(new Intl.Locale('en').numberingSystems));
|
assert(Array.isArray(new Intl.Locale('en').numberingSystems));
|
||||||
|
assert(new Intl.Locale('en').numberingSystems.length > 0, 'array has at least one element');
|
||||||
|
@ -23,3 +23,9 @@ verifyProperty(result, 'direction', {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const direction = new Intl.Locale('en').textInfo.direction;
|
||||||
|
assert(
|
||||||
|
direction === 'rtl' || direction === 'ltr',
|
||||||
|
'value of the `direction` property'
|
||||||
|
);
|
||||||
|
@ -14,3 +14,4 @@ features: [Intl.Locale,Intl.Locale-info]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert(Array.isArray(new Intl.Locale('en-US').timeZones));
|
assert(Array.isArray(new Intl.Locale('en-US').timeZones));
|
||||||
|
assert(new Intl.Locale('en-US').timeZones.length > 0, 'array has at least one element');
|
||||||
|
@ -24,6 +24,9 @@ includes: [propertyHelper.js, compareArray.js]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const result = new Intl.Locale('en').weekInfo;
|
const result = new Intl.Locale('en').weekInfo;
|
||||||
|
function isIntegerBetweenOneAndSeven(value) {
|
||||||
|
return value === 1 || value === 2 || value === 3 || value === 4 || value === 5 || value === 6 || value === 7;
|
||||||
|
}
|
||||||
|
|
||||||
assert.compareArray(Reflect.ownKeys(result), ['firstDay', 'weekendStart', 'weekendEnd', 'minimalDays']);
|
assert.compareArray(Reflect.ownKeys(result), ['firstDay', 'weekendStart', 'weekendEnd', 'minimalDays']);
|
||||||
|
|
||||||
@ -32,21 +35,37 @@ verifyProperty(result, 'firstDay', {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert(
|
||||||
|
isIntegerBetweenOneAndSeven(new Intl.Locale('en').weekInfo.firstDay),
|
||||||
|
'`firstDay` must be an integer between one and seven (inclusive)'
|
||||||
|
);
|
||||||
|
|
||||||
verifyProperty(result, 'weekendStart', {
|
verifyProperty(result, 'weekendStart', {
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert(
|
||||||
|
isIntegerBetweenOneAndSeven(new Intl.Locale('en').weekInfo.weekendStart),
|
||||||
|
'`weekendStart` must be an integer between one and seven (inclusive)'
|
||||||
|
);
|
||||||
|
|
||||||
verifyProperty(result, 'weekendEnd', {
|
verifyProperty(result, 'weekendEnd', {
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert(
|
||||||
|
isIntegerBetweenOneAndSeven(new Intl.Locale('en').weekInfo.weekendEnd),
|
||||||
|
'`weekendEnd` must be an integer between one and seven (inclusive)'
|
||||||
|
);
|
||||||
|
|
||||||
verifyProperty(result, 'minimalDays', {
|
verifyProperty(result, 'minimalDays', {
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert(
|
||||||
|
isIntegerBetweenOneAndSeven(new Intl.Locale('en').weekInfo.minimalDays),
|
||||||
|
'`minimalDays` must be an integer between one and seven (inclusive)'
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user