@@ -13,18 +13,10 @@ describe('MatList', () => {
1313 TestBed . configureTestingModule ( {
1414 imports : [ MatListModule ] ,
1515 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
2820 ] ,
2921 } ) ;
3022
@@ -274,6 +266,15 @@ describe('MatList', () => {
274266 . toBe ( 0 , 'Expected no ripples after list ripples are disabled.' ) ;
275267 } ) ) ;
276268
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+ } ) ;
277278} ) ;
278279
279280
@@ -409,3 +410,18 @@ class ListWithDynamicNumberOfLines extends BaseTestList { }
409410 </mat-list-item>
410411 </mat-list>` } )
411412class 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