@@ -132,6 +132,42 @@ describe('button', () => {
132
132
testBed . fixture . detectChanges ( ) ;
133
133
expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
134
134
} ) ) ;
135
+ it ( 'should icon only works correctly with any tag' , fakeAsync ( ( ) => {
136
+ const testBed = createComponentBed ( TestButtonIconOnlyWithAnyTagComponent , {
137
+ imports : [ NzIconTestModule ] ,
138
+ declarations : [ NzButtonComponent ]
139
+ } ) ;
140
+ const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
141
+ testBed . fixture . detectChanges ( ) ;
142
+ expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
143
+ } ) ) ;
144
+ it ( 'should icon only works correctly with any Comment' , fakeAsync ( ( ) => {
145
+ const testBed = createComponentBed ( TestButtonIconOnlyWithCommentComponent , {
146
+ imports : [ NzIconTestModule ] ,
147
+ declarations : [ NzButtonComponent ]
148
+ } ) ;
149
+ const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
150
+ testBed . fixture . detectChanges ( ) ;
151
+ expect ( buttonElement . classList ) . toContain ( 'ant-btn-icon-only' ) ;
152
+ } ) ) ;
153
+ it ( 'should icon only works correctly with any text' , fakeAsync ( ( ) => {
154
+ const testBed = createComponentBed ( TestButtonIconOnlyWithTextComponent , {
155
+ imports : [ NzIconTestModule ] ,
156
+ declarations : [ NzButtonComponent ]
157
+ } ) ;
158
+ const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
159
+ testBed . fixture . detectChanges ( ) ;
160
+ expect ( buttonElement . classList ) . not . toContain ( 'ant-btn-icon-only' ) ;
161
+ } ) ) ;
162
+ it ( 'should icon only works correctly without nz-icon' , fakeAsync ( ( ) => {
163
+ const testBed = createComponentBed ( TestButtonIconOnlyWithoutIconComponent , {
164
+ imports : [ NzIconTestModule ] ,
165
+ declarations : [ NzButtonComponent ]
166
+ } ) ;
167
+ const buttonElement = testBed . debugElement . query ( By . directive ( NzButtonComponent ) ) . nativeElement ;
168
+ testBed . fixture . detectChanges ( ) ;
169
+ expect ( buttonElement . classList ) . not . toContain ( 'ant-btn-icon-only' ) ;
170
+ } ) ) ;
135
171
it ( 'should icon only loading works correctly' , ( ) => {
136
172
const testBed = createComponentBed ( TestButtonIconOnlyLoadingComponent , {
137
173
imports : [ NzIconTestModule ] ,
@@ -283,6 +319,44 @@ export class TestButtonWithIconComponent implements OnInit {
283
319
} )
284
320
export class TestButtonIconOnlyComponent { }
285
321
322
+ @Component ( {
323
+ template : `
324
+ <button nz-button>
325
+ <u nz-icon nzType="up"></u>
326
+ </button>
327
+ `
328
+ } )
329
+ export class TestButtonIconOnlyWithAnyTagComponent { }
330
+
331
+ @Component ( {
332
+ template : `
333
+ <button nz-button>
334
+ <i nz-icon nzType="down"></i>
335
+ <!-- Comment -->
336
+ </button>
337
+ `
338
+ } )
339
+ export class TestButtonIconOnlyWithCommentComponent { }
340
+
341
+ @Component ( {
342
+ template : `
343
+ <button nz-button>
344
+ <i nz-icon nzType="down"></i>
345
+ text
346
+ </button>
347
+ `
348
+ } )
349
+ export class TestButtonIconOnlyWithTextComponent { }
350
+
351
+ @Component ( {
352
+ template : `
353
+ <button nz-button>
354
+ <span>text</span>
355
+ </button>
356
+ `
357
+ } )
358
+ export class TestButtonIconOnlyWithoutIconComponent { }
359
+
286
360
@Component ( {
287
361
template : `
288
362
<button nz-button nzLoading>
0 commit comments