1- import { Component , ViewChild , OnInit , DebugElement , QueryList , TemplateRef } from '@angular/core' ;
1+ import { Component , ViewChild , OnInit , DebugElement , QueryList , TemplateRef , ContentChild , ViewChildren } from '@angular/core' ;
22import { TestBed , ComponentFixture , fakeAsync , tick , waitForAsync } from '@angular/core/testing' ;
33import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
44import { By } from '@angular/platform-browser' ;
@@ -358,6 +358,16 @@ describe('IgxGrid Master Detail #grid', () => {
358358 const firstDetail = GridFunctions . getMasterRowDetail ( gridRows [ 0 ] ) ;
359359 expect ( firstDetail . textContent . trim ( ) ) . toBe ( 'NEW TEMPLATE' ) ;
360360 } ) ;
361+
362+ it ( 'should allow grids in details view without breaking the column collection of the master grid' , ( ) => {
363+ grid = fix . componentInstance . grid ;
364+ grid . detailTemplate = fix . componentInstance . gridTemplate ;
365+ fix . detectChanges ( ) ;
366+ grid . toggleRow ( fix . componentInstance . data [ 0 ] . ID ) ;
367+ fix . detectChanges ( ) ;
368+ expect ( grid . unpinnedColumns . map ( c => c . field ) ) . toEqual ( [ 'ContactName' , 'CompanyName' ] ) ;
369+ expect ( fix . componentInstance . childGrid . first . unpinnedColumns . map ( c => c . field ) ) . toEqual ( [ 'ColA' , 'ColB' ] ) ;
370+ } ) ;
361371 } ) ;
362372
363373 describe ( 'Keyboard Navigation ' , ( ) => {
@@ -1282,6 +1292,12 @@ describe('IgxGrid Master Detail #grid', () => {
12821292 NEW TEMPLATE
12831293 </div>
12841294 </ng-template>
1295+ <ng-template igxGridDetail #gridTemplate>
1296+ <igx-grid #childGrid>
1297+ <igx-column [field]="'ColA'" [width]="'400px'"></igx-column>
1298+ <igx-column [field]="'ColB'" [width]="'400px'"></igx-column>
1299+ </igx-grid>
1300+ </ng-template>
12851301 ` ,
12861302 imports : [ IgxGridComponent , IgxColumnComponent , IgxGridDetailTemplateDirective , IgxCheckboxComponent , IgxPaginatorComponent , IgxInputGroupComponent , IgxInputDirective ]
12871303} )
@@ -1292,6 +1308,12 @@ export class DefaultGridMasterDetailComponent {
12921308 @ViewChild ( 'detailTemplate' , { read : TemplateRef , static : true } )
12931309 public detailTemplate : TemplateRef < any > ;
12941310
1311+ @ViewChild ( 'gridTemplate' , { read : TemplateRef , static : true } )
1312+ public gridTemplate : TemplateRef < any > ;
1313+
1314+ @ViewChildren ( 'childGrid' , { read : IgxGridComponent } )
1315+ public childGrid : IgxGridComponent ;
1316+
12951317 public width = '800px' ;
12961318 public height = '500px' ;
12971319 public data = SampleTestData . contactInfoDataFull ( ) ;
0 commit comments