44 */
55
66import { Component , inject , OnDestroy } from '@angular/core' ;
7- import { ComponentFixture , TestBed , inject as testingInject } from '@angular/core/testing' ;
7+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
88import { Subscription } from 'rxjs' ;
99
1010import { NZ_I18N , provideNzI18n } from 'ng-zorro-antd/i18n/nz-i18n.token' ;
1111
12- import cs_CZ from './languages/cs_CZ' ;
13- import de_DE from './languages/de_DE' ;
1412import en_US from './languages/en_US' ;
15- import ka_GE from './languages/ka_GE' ;
1613import zh_CN from './languages/zh_CN' ;
1714import { NzI18nInterface } from './nz-i18n.interface' ;
1815import { NzI18nService } from './nz-i18n.service' ;
@@ -23,30 +20,15 @@ describe('i18n service', () => {
2320 let testComponent : NzI18nTestComponent ;
2421 const DEFAULT_LAN = zh_CN ;
2522
26- beforeEach ( ( ) => {
27- TestBed . configureTestingModule ( {
28- providers : [ provideNzI18n ( DEFAULT_LAN ) ]
29- } ) ;
30- } ) ;
31-
3223 describe ( '#setLocale' , ( ) => {
3324 beforeEach ( ( ) => {
25+ TestBed . configureTestingModule ( {
26+ providers : [ provideNzI18n ( DEFAULT_LAN ) ]
27+ } ) ;
28+
3429 fixture = TestBed . createComponent ( NzI18nTestComponent ) ;
3530 testComponent = fixture . debugElement . componentInstance ;
36- } ) ;
37-
38- beforeEach (
39- testingInject ( [ NzI18nService ] , ( s : NzI18nService ) => {
40- srv = s ;
41- } )
42- ) ;
43-
44- it ( 'should interface be right' , ( ) => {
45- const i18nEN : NzI18nInterface = en_US ;
46- const i18nDE : NzI18nInterface = de_DE ;
47- const i18nCS : NzI18nInterface = cs_CZ ;
48- const i18nKA : NzI18nInterface = ka_GE ;
49- console . log ( i18nEN , i18nDE , i18nCS , i18nKA ) ;
31+ srv = TestBed . inject ( NzI18nService ) ;
5032 } ) ;
5133
5234 it ( 'should be provide interface be right' , ( ) => {
@@ -85,6 +67,22 @@ https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md`
8567 ) ;
8668 } ) ;
8769 } ) ;
70+
71+ describe ( 'provideNzI18n' , ( ) => {
72+ beforeEach ( ( ) => {
73+ TestBed . configureTestingModule ( {
74+ providers : [ provideNzI18n ( ( ) => en_US ) ]
75+ } ) ;
76+
77+ fixture = TestBed . createComponent ( NzI18nTestComponent ) ;
78+ testComponent = fixture . debugElement . componentInstance ;
79+ srv = TestBed . inject ( NzI18nService ) ;
80+ } ) ;
81+
82+ it ( 'should factory work' , ( ) => {
83+ expect ( testComponent . locale . locale ) . toBe ( en_US . locale ) ;
84+ } ) ;
85+ } ) ;
8886} ) ;
8987
9088@Component ( {
0 commit comments