@@ -33,7 +33,7 @@ let TestDateRangePicker = (props) => (
33
33
< Text slot = "errorMessage" > Error</ Text >
34
34
< Popover >
35
35
< Dialog >
36
- < RangeCalendar >
36
+ < RangeCalendar focusedValue = { props . focusedValue } >
37
37
< header >
38
38
< Button slot = "previous" > ◀</ Button >
39
39
< Heading />
@@ -280,6 +280,26 @@ describe('DateRangePicker', () => {
280
280
expect ( dialog ) . toBeInTheDocument ( ) ;
281
281
} ) ;
282
282
283
+ it ( 'should set a placeholder time when closing' , async ( ) => {
284
+ let { getByRole, getAllByRole} = render ( < TestDateRangePicker granularity = "second" focusedValue = { new CalendarDate ( 2023 , 1 , 10 ) } /> ) ;
285
+
286
+ let button = getByRole ( 'button' ) ;
287
+ await user . click ( button ) ;
288
+
289
+ let dialog = getByRole ( 'dialog' ) ;
290
+ let cells = getAllByRole ( 'gridcell' ) ;
291
+
292
+ await user . click ( cells [ 5 ] . children [ 0 ] ) ;
293
+ await user . click ( cells [ 10 ] . children [ 0 ] ) ;
294
+ expect ( dialog ) . not . toBeInTheDocument ( ) ;
295
+
296
+ let group = getByRole ( 'group' ) ;
297
+ let inputs = group . querySelectorAll ( '.react-aria-DateInput' ) ;
298
+ let normalize = ( s ) => s . replace ( / \s / g, ' ' ) . replace ( / [ \u2066 \u2069 ] / g, '' ) ;
299
+ expect ( normalize ( inputs [ 0 ] . textContent ) ) . toBe ( normalize ( new Date ( 2023 , 0 , 6 ) . toLocaleString ( ) ) ) ;
300
+ expect ( normalize ( inputs [ 1 ] . textContent ) ) . toBe ( normalize ( new Date ( 2023 , 0 , 11 ) . toLocaleString ( ) ) ) ;
301
+ } ) ;
302
+
283
303
it ( 'should disable button and date input when DatePicker is disabled' , ( ) => {
284
304
let { getByRole} = render ( < TestDateRangePicker isDisabled /> ) ;
285
305
0 commit comments