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