| 1 |
// Copyright 2012 Mozilla Corporation. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es5id: 11.1.1_19 |
| 6 |
description: > |
| 7 |
Tests that the currency style can not be used without a specified |
| 8 |
currency. |
| 9 |
author: Norbert Lindenberg |
| 10 |
---*/ |
| 11 |
|
| 12 |
var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale; |
| 13 |
|
| 14 |
assert.throws(TypeError, function () { |
| 15 |
return new Intl.NumberFormat([defaultLocale], {style: "currency"}); |
| 16 |
}, "Throws TypeError when currency code is not specified."); |
| 17 |
|
| 18 |
assert.throws(TypeError, function () { |
| 19 |
return new Intl.NumberFormat([defaultLocale + "-u-cu-krw"], {style: "currency"}); |
| 20 |
}, "Throws TypeError when currency code is not specified; Currenty code from Unicode locale extension sequence is ignored."); |