@@ -1112,6 +1112,70 @@ describe('IgxGrid - Cell merging #grid', () => {
11121112 ] ) ;
11131113 } ) ;
11141114
1115+ it ( 'should remerge child grid cells when focus moves to parent grid.' , async ( ) => {
1116+ const ri = fix . componentInstance . rowIsland ;
1117+ ri . cellMergeMode = 'always' ;
1118+ ri . getColumnByName ( 'ProductName' ) . merge = true ;
1119+ fix . detectChanges ( ) ;
1120+
1121+ const firstRow = grid . gridAPI . get_row_by_index ( 0 ) as IgxHierarchicalRowComponent ;
1122+ firstRow . toggle ( ) ;
1123+ fix . detectChanges ( ) ;
1124+
1125+ const childGrid = grid . gridAPI . getChildGrids ( false ) [ 0 ] as IgxHierarchicalGridComponent ;
1126+ expect ( childGrid ) . toBeDefined ( ) ;
1127+
1128+ const childCol = childGrid . getColumnByName ( 'ProductName' ) ;
1129+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1130+ { value : 'Product A' , span : 2 } ,
1131+ { value : 'Product B' , span : 1 } ,
1132+ { value : 'Product A' , span : 1 }
1133+ ] ) ;
1134+
1135+ await wait ( 1 ) ;
1136+ fix . detectChanges ( ) ;
1137+
1138+ const allGrids = fix . debugElement . queryAll ( By . directive ( IgxHierarchicalGridComponent ) ) ;
1139+ const childGridDE = allGrids . find ( x => x . componentInstance === childGrid ) ;
1140+ expect ( childGridDE ) . toBeDefined ( ) ;
1141+ const childRows = childGridDE . queryAll ( By . css ( CSS_CLASS_GRID_ROW ) ) ;
1142+ childRows . shift ( ) ;
1143+ const childRowDE = childRows [ 0 ] ;
1144+ const childCells = childRowDE . queryAll ( By . css ( '.igx-grid__td' ) ) ;
1145+ const childCellDE = childCells [ 1 ] ;
1146+ UIInteractions . simulateClickAndSelectEvent ( childCellDE . nativeElement ) ;
1147+ await wait ( 1 ) ;
1148+ fix . detectChanges ( ) ;
1149+
1150+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1151+ { value : 'Product A' , span : 1 } ,
1152+ { value : 'Product A' , span : 1 } ,
1153+ { value : 'Product B' , span : 1 } ,
1154+ { value : 'Product A' , span : 1 }
1155+ ] ) ;
1156+
1157+ const rootGridDE = allGrids . find ( x => x . componentInstance === grid ) ;
1158+ expect ( rootGridDE ) . toBeDefined ( ) ;
1159+ const parentRows = rootGridDE . queryAll ( By . css ( CSS_CLASS_GRID_ROW ) ) ;
1160+ parentRows . shift ( ) ;
1161+ const parentRowDE = parentRows [ 0 ] ;
1162+ const parentCells = parentRowDE . queryAll ( By . css ( '.igx-grid__td' ) ) ;
1163+ const parentCellDE = parentCells [ 1 ] ;
1164+ childCellDE . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , {
1165+ bubbles : true ,
1166+ relatedTarget : parentCellDE . nativeElement
1167+ } ) ) ;
1168+ UIInteractions . simulateClickAndSelectEvent ( parentCellDE . nativeElement ) ;
1169+ await wait ( 1 ) ;
1170+ fix . detectChanges ( ) ;
1171+
1172+ GridFunctions . verifyColumnMergedState ( childGrid , childCol , [
1173+ { value : 'Product A' , span : 2 } ,
1174+ { value : 'Product B' , span : 1 } ,
1175+ { value : 'Product A' , span : 1 }
1176+ ] ) ;
1177+ } ) ;
1178+
11151179 } ) ;
11161180
11171181 describe ( 'TreeGrid' , ( ) => {
0 commit comments