summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/casing-numbering-system-options.js
blob: 11572923c6bc240c60aa821e85fd81a5e7846dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2020 Google Inc, Igalia S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-initializenumberformat
description: >
    Tests that the options numberingSystem are mapped to lower case.
author: Caio Lima
features: [Array.prototype.includes]
---*/

let defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;

let supportedNumberingSystems = ["latn", "arab"].filter(nu =>
  new Intl.NumberFormat(defaultLocale + "-u-nu-" + nu)
    .resolvedOptions().numberingSystem === nu
);

if (supportedNumberingSystems.includes("latn")) {
  let numberFormat = new Intl.NumberFormat(defaultLocale + "-u-nu-lATn");
  assert.sameValue(numberFormat.resolvedOptions().numberingSystem, "latn", "Numbering system option should be in lower case");
}

if (supportedNumberingSystems.includes("arab")) {
  let numberFormat = new Intl.NumberFormat(defaultLocale + "-u-nu-Arab");
  assert.sameValue(numberFormat.resolvedOptions().numberingSystem, "arab", "Numbering system option should be in lower case");
}

reportCompare(0, 0);