@@ -277,29 +277,26 @@ describe('StaffExpenseReport', () => {
277277 } ) ;
278278
279279 it ( 'shows month title and navigation when only category filters are applied' , async ( ) => {
280- const { getByRole, findByRole , findByLabelText, queryByText } = render (
280+ const { getByRole, findByLabelText, findByRole } = render (
281281 < TestComponent /> ,
282282 ) ;
283283
284284 userEvent . click ( getByRole ( 'button' , { name : 'Filter Settings' } ) ) ;
285285
286286 userEvent . click ( await findByLabelText ( 'Assessment' ) ) ;
287- userEvent . click ( await findByRole ( 'button' , { name : 'Apply Filters' } ) ) ;
287+ await waitFor ( ( ) =>
288+ expect ( getByRole ( 'button' , { name : 'Apply Filters' } ) ) . not . toBeDisabled ( ) ,
289+ ) ;
290+ userEvent . click ( getByRole ( 'button' , { name : 'Apply Filters' } ) ) ;
288291
289292 expect (
290293 await findByRole ( 'heading' , { name : 'January 2020' , level : 6 } ) ,
291294 ) . toBeInTheDocument ( ) ;
292- expect (
293- await findByRole ( 'button' , { name : 'Previous Month' } ) ,
294- ) . toBeInTheDocument ( ) ;
295- expect (
296- await findByRole ( 'button' , { name : 'Next Month' } ) ,
297- ) . toBeInTheDocument ( ) ;
298- expect ( queryByText ( 'Clear Filters' ) ) . not . toBeInTheDocument ( ) ;
299- } ) ;
295+ expect ( getByRole ( 'button' , { name : 'Previous Month' } ) ) . toBeInTheDocument ( ) ;
296+ expect ( getByRole ( 'button' , { name : 'Next Month' } ) ) . toBeInTheDocument ( ) ;
297+ } , 10000 ) ;
300298
301299 it ( 'shows filter date range title and hides month navigation when date filters are applied' , async ( ) => {
302- const originalNow = Settings . now ;
303300 Settings . now = ( ) => new Date ( 2020 , 0 , 20 ) . valueOf ( ) ;
304301
305302 const { getByRole, findByRole, getByLabelText, queryByRole } = render (
@@ -330,7 +327,5 @@ describe('StaffExpenseReport', () => {
330327 expect (
331328 queryByRole ( 'button' , { name : 'Next Month' } ) ,
332329 ) . not . toBeInTheDocument ( ) ;
333-
334- Settings . now = originalNow ;
335330 } , 10000 ) ;
336331} ) ;
0 commit comments