@@ -1595,39 +1595,20 @@ describe('IgxGrid - Filtering actions', () => {
15951595 expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
15961596
15971597 // Click on the chip to commit it
1598- const elementRect = filterChip . nativeElement . getBoundingClientRect ( ) ;
1599- UIInteractions . simulatePointerEvent ( 'pointerdown' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1600- await wait ( 16 ) ;
1601- input . nativeElement . blur ( ) ;
1602- await wait ( 16 ) ;
1603- input . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , { bubbles : true } ) ) ;
1604- await wait ( 16 ) ;
1605- ( filterChip as DebugElement ) . nativeElement . focus ( ) ;
1606- UIInteractions . simulatePointerEvent ( 'pointerup' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1607- UIInteractions . simulateMouseEvent ( 'click' , filterChip . nativeElement , 10 , 10 ) ;
1608-
1609- await wait ( 16 ) ;
1598+ ClickElemAndBlur ( filterChip , input ) ;
1599+ await wait ( 200 ) ;
16101600 fix . detectChanges ( ) ;
16111601 expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
16121602
16131603 // Click on the chip to select it
16141604 GridFunctions . clickChip ( filterChip ) ;
16151605 fix . detectChanges ( ) ;
1616- await wait ( 16 ) ;
1606+ await wait ( 100 ) ;
16171607 expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
16181608
16191609 // Click on the chip to commit it
1620- UIInteractions . simulatePointerEvent ( 'pointerdown' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1621- await wait ( 16 ) ;
1622- input . nativeElement . blur ( ) ;
1623- await wait ( 16 ) ;
1624- input . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , { bubbles : true } ) ) ;
1625- await wait ( 16 ) ;
1626- ( filterChip as DebugElement ) . nativeElement . focus ( ) ;
1627- UIInteractions . simulatePointerEvent ( 'pointerup' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1628- UIInteractions . simulateMouseEvent ( 'click' , filterChip . nativeElement , 10 , 10 ) ;
1629-
1630- await wait ( 16 ) ;
1610+ ClickElemAndBlur ( filterChip , input ) ;
1611+ await wait ( 100 ) ;
16311612 fix . detectChanges ( ) ;
16321613 expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
16331614 } ) ;
@@ -1647,17 +1628,7 @@ describe('IgxGrid - Filtering actions', () => {
16471628 expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
16481629
16491630 // Click on the chip to commit it
1650- const elementRect = filterChip . nativeElement . getBoundingClientRect ( ) ;
1651- UIInteractions . simulatePointerEvent ( 'pointerdown' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1652- await wait ( 16 ) ;
1653- input . nativeElement . blur ( ) ;
1654- await wait ( 16 ) ;
1655- input . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , { bubbles : true } ) ) ;
1656- await wait ( 16 ) ;
1657- ( filterChip as DebugElement ) . nativeElement . focus ( ) ;
1658- UIInteractions . simulatePointerEvent ( 'pointerup' , filterChip . nativeElement , elementRect . left , elementRect . top ) ;
1659- UIInteractions . simulateMouseEvent ( 'click' , filterChip . nativeElement , 10 , 10 ) ;
1660-
1631+ ClickElemAndBlur ( filterChip , input ) ;
16611632 fix . detectChanges ( ) ;
16621633 await wait ( 100 ) ;
16631634 expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
@@ -6050,3 +6021,13 @@ function verifyChipVisibility(fix, index: number, shouldBeFullyVisible: boolean)
60506021 expect ( chipRect . left >= visibleChipAreaRect . left && chipRect . right <= visibleChipAreaRect . right )
60516022 . toBe ( shouldBeFullyVisible , 'chip[' + index + '] visibility is incorrect' ) ;
60526023}
6024+
6025+ function ClickElemAndBlur ( clickElem , blurElem ) {
6026+ const elementRect = clickElem . nativeElement . getBoundingClientRect ( ) ;
6027+ UIInteractions . simulatePointerEvent ( 'pointerdown' , clickElem . nativeElement , elementRect . left , elementRect . top ) ;
6028+ blurElem . nativeElement . blur ( ) ;
6029+ blurElem . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , { bubbles : true } ) ) ;
6030+ ( clickElem as DebugElement ) . nativeElement . focus ( ) ;
6031+ UIInteractions . simulatePointerEvent ( 'pointerup' , clickElem . nativeElement , elementRect . left , elementRect . top ) ;
6032+ UIInteractions . simulateMouseEvent ( 'click' , clickElem . nativeElement , 10 , 10 ) ;
6033+ }
0 commit comments