@@ -746,7 +746,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
746746 it ( 'should not persist selection after paging' , ( ) => {
747747 let rows = TreeGridFunctions . getAllRows ( fix ) ;
748748 let treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
749- treeGridCell . nativeElement . dispatchEvent ( new Event ( 'focus' ) ) ;
749+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
750750 fix . detectChanges ( ) ;
751751
752752 expect ( treeGrid . selectedCells . length ) . toBe ( 1 ) ;
@@ -765,7 +765,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
765765
766766 rows = TreeGridFunctions . getAllRows ( fix ) ;
767767 treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
768- treeGridCell . nativeElement . dispatchEvent ( new Event ( 'focus' ) ) ;
768+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
769769 fix . detectChanges ( ) ;
770770
771771 expect ( treeGrid . selectedCells . length ) . toBe ( 1 ) ;
@@ -784,7 +784,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
784784 it ( 'should persist selection after filtering' , fakeAsync ( ( ) => {
785785 const rows = TreeGridFunctions . getAllRows ( fix ) ;
786786 const treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
787- treeGridCell . triggerEventHandler ( 'focus' , new Event ( 'focus' ) ) ;
787+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
788788 fix . detectChanges ( ) ;
789789
790790 treeGrid . filter ( 'ID' , '14' , IgxStringFilteringOperand . instance ( ) . condition ( 'startsWith' ) , true ) ;
@@ -812,8 +812,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
812812
813813 const rows = TreeGridFunctions . getAllRows ( fix ) ;
814814 const treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
815- treeGridCell . triggerEventHandler ( 'focus' , new Event ( 'focus' ) ) ;
816- await wait ( 100 ) ;
815+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
817816 fix . detectChanges ( ) ;
818817
819818 // scroll down 150 pixels
@@ -836,7 +835,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
836835 it ( 'should persist selection after sorting' , ( ) => {
837836 const rows = TreeGridFunctions . getAllRows ( fix ) ;
838837 const treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
839- treeGridCell . triggerEventHandler ( 'focus' , new Event ( 'focus' ) ) ;
838+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
840839 fix . detectChanges ( ) ;
841840
842841 expect ( treeGrid . selectedCells . length ) . toBe ( 1 ) ;
@@ -854,7 +853,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
854853 it ( 'should persist selection after row delete' , ( ) => {
855854 const rows = TreeGridFunctions . getAllRows ( fix ) ;
856855 const treeGridCell = TreeGridFunctions . getTreeCell ( rows [ 0 ] ) ;
857- treeGridCell . triggerEventHandler ( 'focus' , new Event ( 'focus' ) ) ;
856+ UIInteractions . simulateClickAndSelectCellEvent ( treeGridCell ) ;
858857 fix . detectChanges ( ) ;
859858
860859 expect ( treeGrid . selectedCells . length ) . toBe ( 1 ) ;
@@ -920,8 +919,7 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
920919
921920 // select a cell
922921 const targetCell = treeGridCells [ 0 ] ;
923- targetCell . triggerEventHandler ( 'focus' , new Event ( 'focus' ) ) ;
924- tick ( 16 ) ;
922+ UIInteractions . simulateClickAndSelectCellEvent ( targetCell ) ;
925923 fix . detectChanges ( ) ;
926924
927925 // there should be at least one selected cell
0 commit comments