@@ -13,7 +13,7 @@ describe('button', () => {
1313 let testBed : ComponentBed < TestButtonComponent > ;
1414 let buttonElement : HTMLButtonElement ;
1515 beforeEach ( ( ) => {
16- testBed = createComponentBed ( TestButtonComponent , { declarations : [ NzButtonComponent ] } ) ;
16+ testBed = createComponentBed ( TestButtonComponent , { imports : [ NzButtonComponent ] } ) ;
1717 buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
1818 } ) ;
1919
@@ -87,8 +87,7 @@ describe('button', () => {
8787 describe ( 'loading icon' , ( ) => {
8888 it ( 'should hide icon when loading correct' , fakeAsync ( ( ) => {
8989 const testBed = createComponentBed ( TestButtonBindingComponent , {
90- imports : [ NzIconTestModule ] ,
91- declarations : [ NzButtonComponent ]
90+ imports : [ NzIconTestModule , NzButtonComponent ]
9291 } ) ;
9392 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
9493 expect ( buttonElement . classList . contains ( 'ant-btn-loading' ) ) . toBe ( false ) ;
@@ -111,8 +110,7 @@ describe('button', () => {
111110 describe ( 'insert span' , ( ) => {
112111 it ( 'should insert span correctly' , fakeAsync ( ( ) => {
113112 const testBed = createComponentBed ( TestButtonWithIconComponent , {
114- imports : [ NzIconTestModule ] ,
115- declarations : [ NzButtonComponent ]
113+ imports : [ NzIconTestModule , NzButtonComponent ]
116114 } ) ;
117115 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
118116 testBed . fixture . detectChanges ( ) ;
@@ -125,53 +123,47 @@ describe('button', () => {
125123 describe ( 'icon only' , ( ) => {
126124 it ( 'should icon only works correctly' , fakeAsync ( ( ) => {
127125 const testBed = createComponentBed ( TestButtonIconOnlyComponent , {
128- imports : [ NzIconTestModule ] ,
129- declarations : [ NzButtonComponent ]
126+ imports : [ NzIconTestModule , NzButtonComponent ]
130127 } ) ;
131128 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
132129 testBed . fixture . detectChanges ( ) ;
133130 expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
134131 } ) ) ;
135132 it ( 'should icon only works correctly with any tag' , fakeAsync ( ( ) => {
136133 const testBed = createComponentBed ( TestButtonIconOnlyWithAnyTagComponent , {
137- imports : [ NzIconTestModule ] ,
138- declarations : [ NzButtonComponent ]
134+ imports : [ NzIconTestModule , NzButtonComponent ]
139135 } ) ;
140136 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
141137 testBed . fixture . detectChanges ( ) ;
142138 expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
143139 } ) ) ;
144140 it ( 'should icon only works correctly with any Comment' , fakeAsync ( ( ) => {
145141 const testBed = createComponentBed ( TestButtonIconOnlyWithCommentComponent , {
146- imports : [ NzIconTestModule ] ,
147- declarations : [ NzButtonComponent ]
142+ imports : [ NzIconTestModule , NzButtonComponent ]
148143 } ) ;
149144 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
150145 testBed . fixture . detectChanges ( ) ;
151146 expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
152147 } ) ) ;
153148 it ( 'should icon only works correctly with any text' , fakeAsync ( ( ) => {
154149 const testBed = createComponentBed ( TestButtonIconOnlyWithTextComponent , {
155- imports : [ NzIconTestModule ] ,
156- declarations : [ NzButtonComponent ]
150+ imports : [ NzIconTestModule , NzButtonComponent ]
157151 } ) ;
158152 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
159153 testBed . fixture . detectChanges ( ) ;
160154 expect ( buttonElement . classList ) . not . toContain ( 'ant-btn-icon-only' ) ;
161155 } ) ) ;
162156 it ( 'should icon only works correctly without nz-icon' , fakeAsync ( ( ) => {
163157 const testBed = createComponentBed ( TestButtonIconOnlyWithoutIconComponent , {
164- imports : [ NzIconTestModule ] ,
165- declarations : [ NzButtonComponent ]
158+ imports : [ NzIconTestModule , NzButtonComponent ]
166159 } ) ;
167160 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
168161 testBed . fixture . detectChanges ( ) ;
169162 expect ( buttonElement . classList ) . not . toContain ( 'ant-btn-icon-only' ) ;
170163 } ) ) ;
171164 it ( 'should icon only loading works correctly' , ( ) => {
172165 const testBed = createComponentBed ( TestButtonIconOnlyLoadingComponent , {
173- imports : [ NzIconTestModule ] ,
174- declarations : [ NzButtonComponent ]
166+ imports : [ NzIconTestModule , NzButtonComponent ]
175167 } ) ;
176168 testBed . fixture . detectChanges ( ) ;
177169 const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
@@ -184,8 +176,7 @@ describe('button', () => {
184176 let buttonElement : HTMLButtonElement ;
185177 beforeEach ( ( ) => {
186178 testBed = createComponentBed ( TestButtonRtlComponent , {
187- declarations : [ NzButtonComponent ] ,
188- imports : [ BidiModule ]
179+ imports : [ BidiModule , NzButtonComponent , NzButtonComponent ]
189180 } ) ;
190181 buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
191182 } ) ;
@@ -204,7 +195,7 @@ describe('button', () => {
204195 let buttonElement : HTMLButtonElement ;
205196
206197 beforeEach ( ( ) => {
207- testBed = createComponentBed ( TestButtonComponent , { declarations : [ NzButtonComponent ] } ) ;
198+ testBed = createComponentBed ( TestButtonComponent , { imports : [ NzButtonComponent ] } ) ;
208199 buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
209200 } ) ;
210201
@@ -235,7 +226,7 @@ describe('anchor', () => {
235226 let anchorElement : HTMLAnchorElement ;
236227
237228 beforeEach ( ( ) => {
238- testBed = createComponentBed ( TestAnchorComponent , { declarations : [ NzButtonComponent ] } ) ;
229+ testBed = createComponentBed ( TestAnchorComponent , { imports : [ NzButtonComponent ] } ) ;
239230 anchorElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
240231 } ) ;
241232
0 commit comments