@@ -1563,8 +1563,8 @@ describe('IgxGrid - Filtering actions', () => {
1563
1563
1564
1564
reset . nativeElement . focus ( ) ;
1565
1565
inputGroup . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' ) ) ;
1566
+ await wait ( 100 ) ;
1566
1567
fix . detectChanges ( ) ;
1567
- await wait ( 16 ) ;
1568
1568
1569
1569
expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
1570
1570
} ) ;
@@ -1594,19 +1594,22 @@ describe('IgxGrid - Filtering actions', () => {
1594
1594
expect ( filterChip ) . toBeTruthy ( ) ;
1595
1595
expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
1596
1596
1597
- filterChip . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1597
+ // Click on the chip to commit it
1598
+ clickElemAndBlur ( filterChip , input ) ;
1599
+ await wait ( 200 ) ;
1598
1600
fix . detectChanges ( ) ;
1599
- await wait ( 16 ) ;
1600
1601
expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
1601
1602
1602
- filterChip . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1603
+ // Click on the chip to select it
1604
+ GridFunctions . clickChip ( filterChip ) ;
1603
1605
fix . detectChanges ( ) ;
1604
- await wait ( 16 ) ;
1606
+ await wait ( 100 ) ;
1605
1607
expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
1606
1608
1607
- filterChip . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1609
+ // Click on the chip to commit it
1610
+ clickElemAndBlur ( filterChip , input ) ;
1611
+ await wait ( 100 ) ;
1608
1612
fix . detectChanges ( ) ;
1609
- await wait ( 16 ) ;
1610
1613
expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
1611
1614
} ) ;
1612
1615
@@ -1624,34 +1627,35 @@ describe('IgxGrid - Filtering actions', () => {
1624
1627
expect ( filterChip ) . toBeTruthy ( ) ;
1625
1628
expect ( filterChip . componentInstance . selected ) . toBeTruthy ( ) ;
1626
1629
1627
- filterChip . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1630
+ // Click on the chip to commit it
1631
+ clickElemAndBlur ( filterChip , input ) ;
1628
1632
fix . detectChanges ( ) ;
1629
- await wait ( 16 ) ;
1633
+ await wait ( 100 ) ;
1630
1634
expect ( filterChip . componentInstance . selected ) . toBeFalsy ( ) ;
1631
1635
1632
1636
filterValue = 'c' ;
1633
1637
sendInput ( input , filterValue , fix ) ;
1634
1638
fix . detectChanges ( ) ;
1635
- await wait ( 16 ) ;
1639
+ await wait ( 100 ) ;
1636
1640
1637
1641
let filterChips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
1638
1642
expect ( filterChips [ 1 ] ) . toBeTruthy ( ) ;
1639
1643
expect ( filterChips [ 1 ] . componentInstance . selected ) . toBeTruthy ( ) ;
1640
1644
1641
1645
GridFunctions . simulateKeyboardEvent ( input , 'keydown' , 'Enter' ) ;
1642
1646
fix . detectChanges ( ) ;
1643
- await wait ( 16 ) ;
1647
+ await wait ( 100 ) ;
1644
1648
expect ( filterChips [ 1 ] . componentInstance . selected ) . toBeFalsy ( ) ;
1645
1649
1646
1650
let selectedColumn = GridFunctions . getColumnHeader ( 'Downloads' , fix ) ;
1647
1651
selectedColumn . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1648
1652
fix . detectChanges ( ) ;
1649
- await wait ( 16 ) ;
1653
+ await wait ( 100 ) ;
1650
1654
1651
1655
selectedColumn = GridFunctions . getColumnHeader ( 'ProductName' , fix ) ;
1652
1656
selectedColumn . nativeElement . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1653
1657
fix . detectChanges ( ) ;
1654
- await wait ( 16 ) ;
1658
+ await wait ( 100 ) ;
1655
1659
1656
1660
filterChips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
1657
1661
expect ( filterChips [ 0 ] . componentInstance . selected ) . toBeFalsy ( ) ;
@@ -6080,3 +6084,13 @@ function verifyChipVisibility(fix, index: number, shouldBeFullyVisible: boolean)
6080
6084
expect ( chipRect . left >= visibleChipAreaRect . left && chipRect . right <= visibleChipAreaRect . right )
6081
6085
. toBe ( shouldBeFullyVisible , 'chip[' + index + '] visibility is incorrect' ) ;
6082
6086
}
6087
+
6088
+ function clickElemAndBlur ( clickElem , blurElem ) {
6089
+ const elementRect = clickElem . nativeElement . getBoundingClientRect ( ) ;
6090
+ UIInteractions . simulatePointerEvent ( 'pointerdown' , clickElem . nativeElement , elementRect . left , elementRect . top ) ;
6091
+ blurElem . nativeElement . blur ( ) ;
6092
+ blurElem . nativeElement . dispatchEvent ( new FocusEvent ( 'focusout' , { bubbles : true } ) ) ;
6093
+ ( clickElem as DebugElement ) . nativeElement . focus ( ) ;
6094
+ UIInteractions . simulatePointerEvent ( 'pointerup' , clickElem . nativeElement , elementRect . left , elementRect . top ) ;
6095
+ UIInteractions . simulateMouseEvent ( 'click' , clickElem . nativeElement , 10 , 10 ) ;
6096
+ }
0 commit comments