@@ -674,6 +674,36 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
674674 // check row is not selected
675675 GridSelectionFunctions . verifyRowSelected ( firstRow , false ) ;
676676 } ) ;
677+
678+ it ( 'Should not clear root selection state when changing selection mode of child grid' , ( ) => {
679+ rowIsland1 . rowSelection = GridSelectionMode . multiple ;
680+ const firstRow = hierarchicalGrid . getRowByIndex ( 0 ) as IgxHierarchicalRowComponent ;
681+ const secondRow = hierarchicalGrid . getRowByIndex ( 1 ) as IgxHierarchicalRowComponent ;
682+ GridSelectionFunctions . clickRowCheckbox ( firstRow ) ;
683+ GridSelectionFunctions . clickRowCheckbox ( secondRow ) ;
684+
685+ fix . detectChanges ( ) ;
686+ expect ( hierarchicalGrid . getRowByKey ( '0' ) . selected ) . toBeTrue ( ) ;
687+
688+ const thirdRow = hierarchicalGrid . getRowByIndex ( 2 ) as IgxHierarchicalRowComponent ;
689+ thirdRow . toggle ( ) ;
690+ fix . detectChanges ( ) ;
691+
692+ const childGrid = rowIsland1 . rowIslandAPI . getChildGrids ( ) [ 0 ] ;
693+ const firstChildRow = childGrid . getRowByIndex ( 0 ) as IgxHierarchicalRowComponent ;
694+ const secondChildRow = childGrid . getRowByIndex ( 1 ) as IgxHierarchicalRowComponent ;
695+ GridSelectionFunctions . clickRowCheckbox ( firstChildRow ) ;
696+ GridSelectionFunctions . clickRowCheckbox ( secondChildRow ) ;
697+ fix . detectChanges ( ) ;
698+
699+ expect ( hierarchicalGrid . selectedRows ( ) . length ) . toEqual ( 2 ) ;
700+ expect ( childGrid . selectedRows ( ) . length ) . toEqual ( 2 ) ;
701+
702+ rowIsland1 . rowSelection = GridSelectionMode . single ;
703+ fix . detectChanges ( ) ;
704+ expect ( hierarchicalGrid . selectedRows ( ) . length ) . toEqual ( 2 ) ;
705+ expect ( childGrid . selectedRows ( ) . length ) . toEqual ( 0 ) ;
706+ } ) ;
677707 } ) ;
678708
679709 describe ( 'Row Selection CRUD' , ( ) => {
0 commit comments