2013-03-25 07:48:59 +01:00
|
|
|
// Copyright 2013 Mozilla Corporation. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 11.1.1_32
|
2014-07-22 01:09:02 +02:00
|
|
|
description: >
|
|
|
|
Tests that the options minimumSignificantDigits and
|
|
|
|
maximumSignificantDigits are read in the right sequence.
|
|
|
|
author: Norbert Lindenberg
|
|
|
|
---*/
|
2013-03-25 07:48:59 +01:00
|
|
|
|
2017-04-05 19:34:37 +02:00
|
|
|
var minimumSignificantDigitsRead = false;
|
|
|
|
var maximumSignificantDigitsRead = false;
|
2013-03-25 07:48:59 +01:00
|
|
|
|
|
|
|
function readMinimumSignificantDigits() {
|
2017-04-05 19:34:37 +02:00
|
|
|
assert.sameValue(minimumSignificantDigitsRead, false,
|
|
|
|
"minimumSignificantDigits getter already called");
|
|
|
|
assert.sameValue(maximumSignificantDigitsRead, false,
|
|
|
|
"maximumSignificantDigits getter called before minimumSignificantDigits");
|
|
|
|
minimumSignificantDigitsRead = true;
|
|
|
|
return 1;
|
2013-03-25 07:48:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function readMaximumSignificantDigits() {
|
2017-04-05 19:34:37 +02:00
|
|
|
assert.sameValue(maximumSignificantDigitsRead, false,
|
|
|
|
"maximumSignificantDigits getter already called");
|
|
|
|
maximumSignificantDigitsRead = true;
|
|
|
|
return 1;
|
2013-03-25 07:48:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var options = {};
|
|
|
|
Object.defineProperty(options, "minimumSignificantDigits",
|
|
|
|
{ get: readMinimumSignificantDigits });
|
|
|
|
Object.defineProperty(options, "maximumSignificantDigits",
|
|
|
|
{ get: readMaximumSignificantDigits });
|
|
|
|
|
|
|
|
new Intl.NumberFormat("de", options);
|
|
|
|
|
2017-04-05 19:34:37 +02:00
|
|
|
assert(minimumSignificantDigitsRead, "minimumSignificantDigits getter was called once");
|
|
|
|
assert(maximumSignificantDigitsRead, "maximumSignificantDigits getter was called once");
|