summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/default-options-object-prototype.js
blob: 8f43d572f5b4ece7b13dea9e118b42908a94505d (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
// Copyright (C) 2017 Daniel Ehrenberg. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-initializenumberformat
description: >
  Monkey-patching Object.prototype does not change the default
  options for NumberFormat as a null prototype is used.
info: |
  InitializeNumberFormat ( numberFormat, locales, options )

    1. If _options_ is *undefined*, then
      1. Let _options_ be ObjectCreate(*null*).
---*/

let defaultMaximumFractionDigits =
    new Intl.NumberFormat("en").resolvedOptions().maximumFractionDigits;

Object.prototype.maximumFractionDigits = 1;
let formatter = new Intl.NumberFormat("en");
assert.sameValue(formatter.resolvedOptions().maximumFractionDigits,
                 defaultMaximumFractionDigits);

reportCompare(0, 0);