@@ -40,6 +40,7 @@ describe('MatSelectionList without forms', () => {
40
40
SelectionListWithOnlyOneOption ,
41
41
SelectionListWithIndirectChildOptions ,
42
42
SelectionListWithSelectedOptionAndValue ,
43
+ SelectionListWithIndirectDescendantLines ,
43
44
] ,
44
45
} ) ;
45
46
@@ -603,6 +604,14 @@ describe('MatSelectionList without forms', () => {
603
604
expect ( listItemEl . componentInstance . value ) . toBe ( componentFixture . componentInstance . itemValue ) ;
604
605
} ) ;
605
606
607
+ it ( 'should pick up indirect descendant lines' , ( ) => {
608
+ const componentFixture = TestBed . createComponent ( SelectionListWithIndirectDescendantLines ) ;
609
+ componentFixture . detectChanges ( ) ;
610
+
611
+ const option = componentFixture . nativeElement . querySelector ( 'mat-list-option' ) ;
612
+ expect ( option . classList ) . toContain ( 'mat-2-line' ) ;
613
+ } ) ;
614
+
606
615
} ) ;
607
616
608
617
describe ( 'with list option selected' , ( ) => {
@@ -1445,3 +1454,18 @@ class SelectionListWithIcon {
1445
1454
class SelectionListWithIndirectChildOptions {
1446
1455
@ViewChildren ( MatListOption ) optionInstances : QueryList < MatListOption > ;
1447
1456
}
1457
+
1458
+ // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing.
1459
+ @Component ( {
1460
+ template : `
1461
+ <mat-selection-list>
1462
+ <mat-list-option>
1463
+ <ng-container [ngSwitch]="true">
1464
+ <h3 mat-line>Item</h3>
1465
+ <p mat-line>Item description</p>
1466
+ </ng-container>
1467
+ </mat-list-option>
1468
+ </mat-selection-list>`
1469
+ } )
1470
+ class SelectionListWithIndirectDescendantLines {
1471
+ }
0 commit comments