@@ -6,7 +6,7 @@ import { IgxPaginatorComponent } from 'igniteui-angular/paginator';;
66import { DataParent } from '../../../test-utils/sample-test-data.spec' ;
77import { GridFunctions , GridSelectionFunctions } from '../../../test-utils/grid-functions.spec' ;
88import { By } from '@angular/platform-browser' ;
9- import { UIInteractions , wait } from '../../../test-utils/ui-interactions.spec' ;
9+ import { UIInteractions , wait , waitForActiveNodeChange } from '../../../test-utils/ui-interactions.spec' ;
1010import { hasClass , setElementSize } from '../../../test-utils/helper-utils.spec' ;
1111import { ColumnLayoutTestComponent } from './grid.multi-row-layout.spec' ;
1212import { IgxHierarchicalGridTestBaseComponent } from '../../hierarchical-grid/src/hierarchical-grid.spec' ;
@@ -1113,6 +1113,68 @@ describe('IgxGrid - Cell merging #grid', () => {
11131113 ] ) ;
11141114 } ) ;
11151115
1116+ it ( 'should remerge child grid cells when focus moves to parent grid.' , async ( ) => {
1117+ const ri = fix . componentInstance . rowIsland ;
1118+ ri . cellMergeMode = 'always' ;
1119+ ri . getColumnByName ( 'ProductName' ) . merge = true ;
1120+ fix . detectChanges ( ) ;
1121+
1122+ const firstRow = grid . gridAPI . get_row_by_index ( 0 ) as IgxHierarchicalRowComponent ;
1123+ firstRow . toggle ( ) ;
1124+ fix . detectChanges ( ) ;
1125+
1126+ const childGrid = grid . gridAPI . getChildGrids ( false ) [ 0 ] as IgxHierarchicalGridComponent ;
1127+ expect ( childGrid ) . toBeDefined ( ) ;
1128+
1129+ const childCol = childGrid . getColumnByName ( 'ProductName' ) ;
1130+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1131+ { value : 'Product A' , span : 2 } ,
1132+ { value : 'Product B' , span : 1 } ,
1133+ { value : 'Product A' , span : 1 }
1134+ ] ) ;
1135+
1136+ await wait ( 1 ) ;
1137+ fix . detectChanges ( ) ;
1138+
1139+ const allGrids = fix . debugElement . queryAll ( By . directive ( IgxHierarchicalGridComponent ) ) ;
1140+ const childGridDE = allGrids . find ( x => x . componentInstance === childGrid ) ;
1141+ expect ( childGridDE ) . toBeDefined ( ) ;
1142+ const childRows = childGridDE . queryAll ( By . css ( CSS_CLASS_GRID_ROW ) ) ;
1143+ childRows . shift ( ) ;
1144+ const childRowDE = childRows [ 0 ] ;
1145+ const childCells = childRowDE . queryAll ( By . css ( '.igx-grid__td' ) ) ;
1146+ const childCellDE = childCells [ 1 ] ;
1147+ UIInteractions . simulateClickAndSelectEvent ( childCellDE . nativeElement ) ;
1148+ await wait ( 1 ) ;
1149+ fix . detectChanges ( ) ;
1150+
1151+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1152+ { value : 'Product A' , span : 1 } ,
1153+ { value : 'Product A' , span : 1 } ,
1154+ { value : 'Product B' , span : 1 } ,
1155+ { value : 'Product A' , span : 1 }
1156+ ] ) ;
1157+
1158+ const rootGridDE = allGrids . find ( x => x . componentInstance === grid ) ;
1159+ expect ( rootGridDE ) . toBeDefined ( ) ;
1160+ const parentRows = rootGridDE . queryAll ( By . css ( CSS_CLASS_GRID_ROW ) ) ;
1161+ parentRows . shift ( ) ;
1162+ const parentRowDE = parentRows [ 0 ] ;
1163+ const parentCells = parentRowDE . queryAll ( By . css ( '.igx-grid__td' ) ) ;
1164+ const parentCellDE = parentCells [ 1 ] ;
1165+ const activeChange = waitForActiveNodeChange ( childGrid ) ;
1166+ UIInteractions . simulateClickAndSelectEvent ( parentCellDE . nativeElement ) ;
1167+ await activeChange ;
1168+ await wait ( 20 ) ;
1169+ fix . detectChanges ( ) ;
1170+
1171+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1172+ { value : 'Product A' , span : 2 } ,
1173+ { value : 'Product B' , span : 1 } ,
1174+ { value : 'Product A' , span : 1 }
1175+ ] ) ;
1176+ } ) ;
1177+
11161178 } ) ;
11171179
11181180 describe ( 'TreeGrid' , ( ) => {
0 commit comments