@@ -46,16 +46,10 @@ describe('search-bar', () => {
46
46
47
47
it ( 'Handles date range search queries for startDate' , ( ) => {
48
48
const onSearch = jest . fn ( ) ;
49
- render ( < SearchBar inputIdSuffix = "1" onSearch = { onSearch } /> ) ;
50
-
51
- // To open and interact with the calendar, we first need to focus the input it's attached to.
52
- const startDateInput = screen . getByLabelText ( / s t a r t d a t e / i) ;
53
- fireEvent . focus ( startDateInput ) ;
49
+ render ( < SearchBar onSearch = { onSearch } /> ) ;
54
50
55
- // The actual button text is something like "Choose Sunday, June 1, 2025, blah blah".
56
- // This should get us close enough. There will be more than one (for the current and previous month).
57
- const calendarDay = screen . getAllByRole ( 'button' , { name : / C h o o s e .* 1 , / } ) ;
58
- fireEvent . click ( calendarDay [ 0 ] ) ;
51
+ const startDateInput = screen . getByLabelText ( / f r o m d a t e / i) ;
52
+ fireEvent . change ( startDateInput , { target : { value : '2025-06-01' } } ) ;
59
53
60
54
expect ( onSearch ) . toHaveBeenCalledWith ( {
61
55
url : null ,
@@ -66,15 +60,10 @@ describe('search-bar', () => {
66
60
67
61
it ( 'Handles date range search queries for endDate' , ( ) => {
68
62
const onSearch = jest . fn ( ) ;
69
- render ( < SearchBar inputIdSuffix = "1" onSearch = { onSearch } /> ) ;
70
-
71
- const endDateInput = screen . getByLabelText ( / e n d d a t e / i) ;
72
- fireEvent . focus ( endDateInput ) ;
63
+ render ( < SearchBar onSearch = { onSearch } /> ) ;
73
64
74
- // The actual button text is something like "Choose Sunday, June 1, 2025, blah blah".
75
- // This should get us close enough. There will be more than one (for the current and previous month).
76
- const calendarDay = screen . getAllByRole ( 'button' , { name : / C h o o s e .* 1 , / } ) ;
77
- fireEvent . click ( calendarDay [ 0 ] ) ;
65
+ const endDateInput = screen . getByLabelText ( / t o d a t e / i) ;
66
+ fireEvent . change ( endDateInput , { target : { value : '2025-06-01' } } ) ;
78
67
79
68
expect ( onSearch ) . toHaveBeenCalledWith ( {
80
69
url : null ,
0 commit comments