@@ -32,6 +32,7 @@ describe('MatGridList', () => {
32
32
GridListWithoutMatchingGap ,
33
33
GridListWithEmptyDirectionality ,
34
34
GridListWithRtl ,
35
+ GridListWithIndirectTileDescendants ,
35
36
] ,
36
37
} ) ;
37
38
@@ -317,6 +318,15 @@ describe('MatGridList', () => {
317
318
expect ( tile . style . left ) . toBe ( '' ) ;
318
319
expect ( tile . style . right ) . toBe ( '0px' ) ;
319
320
} ) ;
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
+
320
330
} ) ;
321
331
322
332
@@ -509,3 +519,17 @@ class GridListWithEmptyDirectionality { }
509
519
providers : [ { provide : Directionality , useValue : { value : 'rtl' } } ]
510
520
} )
511
521
class 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