@@ -18,7 +18,8 @@ import { OneGroupOneColGridComponent, OneGroupThreeColsGridComponent,
1818 NestedColGroupsGridComponent , StegosaurusGridComponent ,
1919 OneColPerGroupGridComponent , NestedColumnGroupsGridComponent ,
2020 DynamicGridComponent , NestedColGroupsWithTemplatesGridComponent ,
21- DynamicColGroupsGridComponent } from '../../test-utils/grid-mch-sample.spec' ;
21+ DynamicColGroupsGridComponent ,
22+ ColumnGroupHiddenInTemplateComponent } from '../../test-utils/grid-mch-sample.spec' ;
2223import { CellType } from '../common/grid.interface' ;
2324
2425const GRID_COL_THEAD_TITLE_CLASS = 'igx-grid-th__title' ;
@@ -47,7 +48,8 @@ describe('IgxGrid - multi-column headers #grid', () => {
4748 NestedColumnGroupsGridComponent ,
4849 DynamicGridComponent ,
4950 NestedColGroupsWithTemplatesGridComponent ,
50- DynamicColGroupsGridComponent
51+ DynamicColGroupsGridComponent ,
52+ ColumnGroupHiddenInTemplateComponent
5153 ]
5254 } )
5355 . compileComponents ( ) ;
@@ -392,6 +394,20 @@ describe('IgxGrid - multi-column headers #grid', () => {
392394 expect ( generalHeader . nativeElement . firstElementChild . title ) . toBe ( 'General Information Title' ) ;
393395 expect ( addressHeader . nativeElement . firstElementChild . title ) . toBe ( 'Address Information' ) ;
394396 } ) ;
397+
398+ it ( 'should hide column group when hidden property is set to true in the template - parent and child level' , ( ) => {
399+ fixture = TestBed . createComponent ( ColumnGroupHiddenInTemplateComponent ) ;
400+ fixture . detectChanges ( ) ;
401+
402+ grid = fixture . componentInstance . grid ;
403+ const generalGroup = grid . columnList . find ( c => c . header === 'General Information' ) ;
404+ const locationGroup = grid . columnList . find ( c => c . header === 'Location' ) ;
405+ expect ( generalGroup . hidden ) . toBe ( true ) ;
406+ expect ( locationGroup . hidden ) . toBe ( true ) ;
407+
408+ expect ( GridFunctions . getColumnHeaders ( fixture ) . length ) . toEqual ( 6 ) ;
409+ expect ( GridFunctions . getColumnGroupHeaders ( fixture ) . length ) . toEqual ( 2 ) ;
410+ } ) ;
395411 } ) ;
396412
397413 describe ( 'Columns widths tests (1 group 1 column) ' , ( ) => {
0 commit comments