@@ -13,18 +13,10 @@ describe('MatList', () => {
13
13
TestBed . configureTestingModule ( {
14
14
imports : [ MatListModule ] ,
15
15
declarations : [
16
- ListWithOneAnchorItem ,
17
- ListWithOneItem ,
18
- ListWithTwoLineItem ,
19
- ListWithThreeLineItem ,
20
- ListWithAvatar ,
21
- ListWithItemWithCssClass ,
22
- ListWithDynamicNumberOfLines ,
23
- ListWithMultipleItems ,
24
- ListWithManyLines ,
25
- NavListWithOneAnchorItem ,
26
- ActionListWithoutType ,
27
- ActionListWithType
16
+ ListWithOneAnchorItem , ListWithOneItem , ListWithTwoLineItem , ListWithThreeLineItem ,
17
+ ListWithAvatar , ListWithItemWithCssClass , ListWithDynamicNumberOfLines ,
18
+ ListWithMultipleItems , ListWithManyLines , NavListWithOneAnchorItem , ActionListWithoutType ,
19
+ ActionListWithType , ListWithIndirectDescendantLines
28
20
] ,
29
21
} ) ;
30
22
@@ -274,6 +266,15 @@ describe('MatList', () => {
274
266
. toBe ( 0 , 'Expected no ripples after list ripples are disabled.' ) ;
275
267
} ) ) ;
276
268
269
+
270
+ it ( 'should pick up indirect descendant lines' , ( ) => {
271
+ const fixture = TestBed . createComponent ( ListWithIndirectDescendantLines ) ;
272
+ fixture . detectChanges ( ) ;
273
+
274
+ const listItems = fixture . debugElement . children [ 0 ] . queryAll ( By . css ( 'mat-list-item' ) ) ;
275
+ expect ( listItems [ 0 ] . nativeElement . className ) . toContain ( 'mat-2-line' ) ;
276
+ expect ( listItems [ 1 ] . nativeElement . className ) . toContain ( 'mat-2-line' ) ;
277
+ } ) ;
277
278
} ) ;
278
279
279
280
@@ -409,3 +410,18 @@ class ListWithDynamicNumberOfLines extends BaseTestList { }
409
410
</mat-list-item>
410
411
</mat-list>` } )
411
412
class ListWithMultipleItems extends BaseTestList { }
413
+
414
+ // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing.
415
+ @Component ( {
416
+ template : `
417
+ <mat-list>
418
+ <mat-list-item *ngFor="let item of items">
419
+ <ng-container [ngSwitch]="true">
420
+ <h3 mat-line>{{item.name}}</h3>
421
+ <p mat-line>{{item.description}}</p>
422
+ </ng-container>
423
+ </mat-list-item>
424
+ </mat-list>`
425
+ } )
426
+ class ListWithIndirectDescendantLines extends BaseTestList {
427
+ }
0 commit comments