File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11import React , { createRef , PropsWithChildren , useState } from 'react' ;
2- import { render , waitFor } from '@testing-library/react' ;
2+ import { act , render , waitFor } from '@testing-library/react' ;
33import userEvent from '@testing-library/user-event' ;
44
55import { Month , newUTC } from '@leafygreen-ui/date-utils' ;
@@ -339,17 +339,19 @@ describe('packages/date-picker/menu/header', () => {
339339 exact : false ,
340340 } ) ;
341341 userEvent . click ( monthSelect ) ;
342+ act ( ( ) => jest . advanceTimersByTime ( transitionDuration . default ) ) ;
343+
342344 await waitFor ( ( ) => {
343- jest . advanceTimersByTime ( transitionDuration . default ) ;
344345 expect ( mockSetIsSelectOpen ) . toHaveBeenCalledWith ( true ) ;
345346 } ) ;
346347
347348 const options = await findAllByRole ( 'option' ) ;
348349 await waitFor ( ( ) => expect ( options [ 0 ] ) . toBeInTheDocument ( ) ) ;
349350
350351 userEvent . click ( monthSelect ) ;
352+ act ( ( ) => jest . advanceTimersByTime ( transitionDuration . default ) ) ;
353+
351354 await waitFor ( ( ) => {
352- jest . advanceTimersByTime ( transitionDuration . default ) ;
353355 expect ( mockSetIsSelectOpen ) . toHaveBeenCalledWith ( false ) ;
354356 } ) ;
355357 } ) ;
You can’t perform that action at this time.
0 commit comments