@@ -32,6 +32,7 @@ describe('MatGridList', () => {
3232 GridListWithoutMatchingGap ,
3333 GridListWithEmptyDirectionality ,
3434 GridListWithRtl ,
35+ GridListWithIndirectTileDescendants ,
3536 ] ,
3637 } ) ;
3738
@@ -317,6 +318,15 @@ describe('MatGridList', () => {
317318 expect ( tile . style . left ) . toBe ( '' ) ;
318319 expect ( tile . style . right ) . toBe ( '0px' ) ;
319320 } ) ;
321+
322+ it ( 'should lay out the tiles if they are not direct descendants of the list' , ( ) => {
323+ const fixture = TestBed . createComponent ( GridListWithIndirectTileDescendants ) ;
324+ fixture . detectChanges ( ) ;
325+
326+ const tile = fixture . debugElement . query ( By . directive ( MatGridTile ) ) ;
327+ expect ( getStyle ( tile , 'padding-top' ) ) . toBe ( '200px' ) ;
328+ } ) ;
329+
320330} ) ;
321331
322332
@@ -509,3 +519,17 @@ class GridListWithEmptyDirectionality { }
509519 providers : [ { provide : Directionality , useValue : { value : 'rtl' } } ]
510520} )
511521class GridListWithRtl { }
522+
523+ @Component ( {
524+ // Note the blank `ngSwitch` which we need in order to hit the bug that we're testing.
525+ template : `
526+ <div style="width:200px">
527+ <mat-grid-list cols="1">
528+ <ng-container [ngSwitch]="true">
529+ <mat-grid-tile></mat-grid-tile>
530+ </ng-container>
531+ </mat-grid-list>
532+ </div>
533+ `
534+ } )
535+ class GridListWithIndirectTileDescendants { }
0 commit comments