summaryrefslogtreecommitdiff
path: root/test/intl402
diff options
context:
space:
mode:
authorAndré Bargull <andre.bargull@gmail.com>2017-12-21 12:08:22 -0800
committerRick Waldron <waldron.rick@gmail.com>2017-12-21 16:46:56 -0500
commitf65bd7af7a57dc28b022ffa1332f1d9337137505 (patch)
treecb87ed9790aedcc8cb47a1fd4b4024a7aca73ff5 /test/intl402
parent72db5f1ec1288ac9f73212a46914be9acc652058 (diff)
downloadqtdeclarative-testsuites-f65bd7af7a57dc28b022ffa1332f1d9337137505.tar.gz
Require correct hour-cycle setting instead of either h11 or h12 resp. h23 or h24
Diffstat (limited to 'test/intl402')
-rw-r--r--test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js56
1 files changed, 21 insertions, 35 deletions
diff --git a/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js b/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js
index 1bd3cc968..b3055c4b4 100644
--- a/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js
+++ b/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js
@@ -14,50 +14,36 @@ includes: [testIntl.js, propertyHelper.js]
/* Values passed via unicode extension key work */
-/**
- * Since at the moment of writing, CLDR does not provide data for any locale
- * that would allow it to use both 0-based and 1-based hourCycles,
- * we can only test if the result is within the pair of h11/h12 or h23/h24.
- */
-const hcValuePairs = [
- ["h11", "h12"],
- ["h23", "h24"]
-];
-
+const hcValues = ['h11', 'h12', 'h23', 'h24'];
const hour12Values = ['h11', 'h12'];
-const hour24Values = ['h23', 'h24'];
const dataPropertyDesc = { writable: true, enumerable: true, configurable: true };
-for (const hcValuePair of hcValuePairs) {
- for (const hcValue of hcValuePair) {
- const resolvedOptions = new Intl.DateTimeFormat(`de-u-hc-${hcValue}`, {
- hour: 'numeric'
- }).resolvedOptions();
+for (const hcValue of hcValues) {
+ const resolvedOptions = new Intl.DateTimeFormat(`de-u-hc-${hcValue}`, {
+ hour: 'numeric'
+ }).resolvedOptions();
- assert(hcValuePair.includes(resolvedOptions.hourCycle));
- assert.sameValue(resolvedOptions.hour12, hour12Values.includes(hcValue));
+ assert.sameValue(resolvedOptions.hourCycle, hcValue);
+ assert.sameValue(resolvedOptions.hour12, hour12Values.includes(hcValue));
- verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
- verifyProperty(resolvedOptions, 'hour12', dataPropertyDesc);
- }
+ verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
+ verifyProperty(resolvedOptions, 'hour12', dataPropertyDesc);
}
/* Values passed via options work */
-for (const hcValuePair of hcValuePairs) {
- for (const hcValue of hcValuePair) {
- const resolvedOptions = new Intl.DateTimeFormat(`en-US`, {
- hour: 'numeric',
- hourCycle: hcValue
- }).resolvedOptions();
+for (const hcValue of hcValues) {
+ const resolvedOptions = new Intl.DateTimeFormat(`en-US`, {
+ hour: 'numeric',
+ hourCycle: hcValue
+ }).resolvedOptions();
- assert(hcValuePair.includes(resolvedOptions.hourCycle));
- assert.sameValue(resolvedOptions.hour12, hour12Values.includes(hcValue));
+ assert.sameValue(resolvedOptions.hourCycle, hcValue);
+ assert.sameValue(resolvedOptions.hour12, hour12Values.includes(hcValue));
- verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
- verifyProperty(resolvedOptions, 'hour12', dataPropertyDesc);
- }
+ verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
+ verifyProperty(resolvedOptions, 'hour12', dataPropertyDesc);
}
/* When both extension key and option is passed, option takes precedence */
@@ -67,7 +53,7 @@ let resolvedOptions = new Intl.DateTimeFormat(`en-US-u-hc-h12`, {
hourCycle: 'h23'
}).resolvedOptions();
-assert(['h23', 'h24'].includes(resolvedOptions.hourCycle));
+assert.sameValue(resolvedOptions.hourCycle, 'h23');
assert.sameValue(resolvedOptions.hour12, false);
verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
@@ -81,7 +67,7 @@ resolvedOptions = new Intl.DateTimeFormat(`fr`, {
hourCycle: 'h23'
}).resolvedOptions();
-assert(['h11', 'h12'].includes(resolvedOptions.hourCycle));
+assert(hour12Values.includes(resolvedOptions.hourCycle));
assert.sameValue(resolvedOptions.hour12, true);
verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);
@@ -94,7 +80,7 @@ resolvedOptions = new Intl.DateTimeFormat(`fr-u-hc-h24`, {
hour12: true,
}).resolvedOptions();
-assert(['h11', 'h12'].includes(resolvedOptions.hourCycle));
+assert(hour12Values.includes(resolvedOptions.hourCycle));
assert.sameValue(resolvedOptions.hour12, true);
verifyProperty(resolvedOptions, 'hourCycle', dataPropertyDesc);