fix(common): export currencies via getCurrencySymbol (#20983)

PR Close #20983
This commit is contained in:
Olivier Combe
2017-12-13 15:16:05 +01:00
committed by Kara Erickson
parent 2fc4cf67be
commit fecf768f43
7 changed files with 34 additions and 18 deletions

View File

@ -11,7 +11,7 @@ import localeEn from '@angular/common/locales/en';
import localeFr from '@angular/common/locales/fr';
import localeFrCA from '@angular/common/locales/fr-CA';
import {registerLocaleData} from '../../src/i18n/locale_data';
import {findLocaleData} from '../../src/i18n/locale_data_api';
import {findLocaleData, getCurrencySymbol} from '../../src/i18n/locale_data_api';
{
describe('locale data api', () => {
@ -51,5 +51,18 @@ import {findLocaleData} from '../../src/i18n/locale_data_api';
expect(findLocaleData('fake-id2')).toEqual(localeFrCA);
});
});
describe('getCurrencySymbolElseCode', () => {
it('should return the correct symbol', () => {
expect(getCurrencySymbol('USD', 'wide')).toEqual('$');
expect(getCurrencySymbol('USD', 'narrow')).toEqual('$');
expect(getCurrencySymbol('AUD', 'wide')).toEqual('A$');
expect(getCurrencySymbol('AUD', 'narrow')).toEqual('$');
expect(getCurrencySymbol('CRC', 'wide')).toEqual('CRC');
expect(getCurrencySymbol('CRC', 'narrow')).toEqual('₡');
expect(getCurrencySymbol('FAKE', 'wide')).toEqual('FAKE');
expect(getCurrencySymbol('FAKE', 'narrow')).toEqual('FAKE');
});
});
});
}