88
99import localeEn from '../../locales/en' ;
1010import localeEsUS from '../../locales/es-US' ;
11+ import localeFr from '../../locales/fr' ;
1112import { registerLocaleData , CurrencyPipe , DecimalPipe , PercentPipe } from '@angular/common' ;
1213import { beforeEach , describe , expect , it } from '@angular/core/testing/src/testing_internal' ;
1314
@@ -16,6 +17,7 @@ export function main() {
1617 beforeAll ( ( ) => {
1718 registerLocaleData ( localeEn ) ;
1819 registerLocaleData ( localeEsUS ) ;
20+ registerLocaleData ( localeFr ) ;
1921 } ) ;
2022
2123 function isNumeric ( value : any ) : boolean { return ! isNaN ( value - parseFloat ( value ) ) ; }
@@ -72,6 +74,8 @@ export function main() {
7274 it ( 'should return correct value for numbers' , ( ) => {
7375 expect ( pipe . transform ( 1.23 ) ) . toEqual ( '123%' ) ;
7476 expect ( pipe . transform ( 1.2 , '.2' ) ) . toEqual ( '120.00%' ) ;
77+ expect ( pipe . transform ( 1.2 , '4.2' ) ) . toEqual ( '0,120.00%' ) ;
78+ expect ( pipe . transform ( 1.2 , '4.2' , 'fr' ) ) . toEqual ( '0 120,00 %' ) ;
7579 } ) ;
7680
7781 it ( 'should not support other objects' ,
@@ -93,6 +97,9 @@ export function main() {
9397 expect ( pipe . transform ( 5.1234 , 'USD' , 'symbol' ) ) . toEqual ( '$5.12' ) ;
9498 expect ( pipe . transform ( 5.1234 , 'CAD' , 'symbol' ) ) . toEqual ( 'CA$5.12' ) ;
9599 expect ( pipe . transform ( 5.1234 , 'CAD' , 'symbol-narrow' ) ) . toEqual ( '$5.12' ) ;
100+ expect ( pipe . transform ( 5.1234 , 'CAD' , 'symbol-narrow' , '5.2-2' ) ) . toEqual ( '$00,005.12' ) ;
101+ expect ( pipe . transform ( 5.1234 , 'CAD' , 'symbol-narrow' , '5.2-2' , 'fr' ) )
102+ . toEqual ( '00 005,12 $' ) ;
96103 } ) ;
97104
98105 it ( 'should not support other objects' ,
0 commit comments