File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -561,9 +561,7 @@ describe('Trigger.Basic', () => {
561
561
it ( `${
562
562
mockRect ? 'offset' : 'getBoundingClientRect'
563
563
} : ${ prop } `, async ( ) => {
564
- const onPopupAlign = jest . fn ( ( ) => {
565
- expect ( rectCalled ) . toBeTruthy ( ) ;
566
- } ) ;
564
+ const onPopupAlign = jest . fn ( ) ;
567
565
568
566
const { container } = createTrigger ( prop , {
569
567
onPopupAlign,
@@ -573,15 +571,15 @@ describe('Trigger.Basic', () => {
573
571
expect ( rectCalled ) . toBeFalsy ( ) ;
574
572
expect ( onPopupAlign ) . not . toHaveBeenCalled ( ) ;
575
573
574
+ // Click will trigger `onPrepare` which need measure target size
576
575
fireEvent . click ( container . querySelector ( '.target' ) ) ;
577
- for ( let i = 0 ; i < 10 ; i += 1 ) {
578
- await act ( async ( ) => {
579
- jest . advanceTimersByTime ( 100 ) ;
580
- await Promise . resolve ( ) ;
581
- } ) ;
582
- }
583
-
584
576
expect ( rectCalled ) . toBeTruthy ( ) ;
577
+
578
+ // Flush for motion
579
+ await act ( async ( ) => {
580
+ jest . advanceTimersByTime ( 100 ) ;
581
+ await Promise . resolve ( ) ;
582
+ } ) ;
585
583
expect ( onPopupAlign ) . toHaveBeenCalled ( ) ;
586
584
587
585
expect (
You can’t perform that action at this time.
0 commit comments