8
8
9
9
import localeEn from '../../locales/en' ;
10
10
import localeEsUS from '../../locales/es-US' ;
11
+ import localeFr from '../../locales/fr' ;
11
12
import { registerLocaleData , CurrencyPipe , DecimalPipe , PercentPipe } from '@angular/common' ;
12
13
import { beforeEach , describe , expect , it } from '@angular/core/testing/src/testing_internal' ;
13
14
@@ -16,6 +17,7 @@ export function main() {
16
17
beforeAll ( ( ) => {
17
18
registerLocaleData ( localeEn ) ;
18
19
registerLocaleData ( localeEsUS ) ;
20
+ registerLocaleData ( localeFr ) ;
19
21
} ) ;
20
22
21
23
function isNumeric ( value : any ) : boolean { return ! isNaN ( value - parseFloat ( value ) ) ; }
@@ -72,6 +74,8 @@ export function main() {
72
74
it ( 'should return correct value for numbers' , ( ) => {
73
75
expect ( pipe . transform ( 1.23 ) ) . toEqual ( '123%' ) ;
74
76
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 %' ) ;
75
79
} ) ;
76
80
77
81
it ( 'should not support other objects' ,
@@ -93,6 +97,9 @@ export function main() {
93
97
expect ( pipe . transform ( 5.1234 , 'USD' , 'symbol' ) ) . toEqual ( '$5.12' ) ;
94
98
expect ( pipe . transform ( 5.1234 , 'CAD' , 'symbol' ) ) . toEqual ( 'CA$5.12' ) ;
95
99
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 $' ) ;
96
103
} ) ;
97
104
98
105
it ( 'should not support other objects' ,
0 commit comments