casing-numbering-system-options.js (1087B)
1 // Copyright 2020 Google Inc, Igalia S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-initializenumberformat 6 description: > 7 Tests that the options numberingSystem are mapped to lower case. 8 author: Caio Lima 9 features: [Array.prototype.includes] 10 ---*/ 11 12 let defaultLocale = new Intl.NumberFormat().resolvedOptions().locale; 13 14 let supportedNumberingSystems = ["latn", "arab"].filter(nu => 15 new Intl.NumberFormat(defaultLocale + "-u-nu-" + nu) 16 .resolvedOptions().numberingSystem === nu 17 ); 18 19 if (supportedNumberingSystems.includes("latn")) { 20 let numberFormat = new Intl.NumberFormat(defaultLocale + "-u-nu-lATn"); 21 assert.sameValue(numberFormat.resolvedOptions().numberingSystem, "latn", "Numbering system option should be in lower case"); 22 } 23 24 if (supportedNumberingSystems.includes("arab")) { 25 let numberFormat = new Intl.NumberFormat(defaultLocale + "-u-nu-Arab"); 26 assert.sameValue(numberFormat.resolvedOptions().numberingSystem, "arab", "Numbering system option should be in lower case"); 27 } 28 29 reportCompare(0, 0);