@@ -86,7 +86,7 @@ test("DateInput defaults tabbable item to today's date", async () => {
86
86
expect ( current ) . toHaveProperty ( 'tabIndex' , 0 )
87
87
} )
88
88
89
- test ( ' DateInput sets empty input to an empty string' , async ( ) => {
89
+ test ( " DateInput sets empty input to an empty string" , async ( ) => {
90
90
const user = userEvent . setup ( )
91
91
const onChange = jest . fn ( )
92
92
const props = { input : { ...input , onChange, onBlur : noop } , meta : { } }
@@ -97,4 +97,23 @@ test('DateInput sets empty input to an empty string', async () => {
97
97
98
98
expect ( onChange ) . toHaveBeenCalledTimes ( 1 )
99
99
expect ( onChange ) . toHaveBeenCalledWith ( '' )
100
+ } )
101
+
102
+ test ( "DateInput invokes onBlur when focus changes" , async ( ) => {
103
+ const user = userEvent . setup ( )
104
+ const onBlur = jest . fn ( )
105
+ const onChange = jest . fn ( )
106
+ const props = { input : { ...input , onChange, onBlur } , meta : { } }
107
+
108
+ render ( < WrappedDateInput { ...props } /> )
109
+
110
+ await user . click ( screen . getByRole ( 'textbox' ) )
111
+
112
+ const option = screen
113
+ . getAllByRole ( 'option' , { selected : false , hidden : false } )
114
+ . at ( 0 )
115
+ await user . click ( option )
116
+ await user . tab ( )
117
+
118
+ expect ( onBlur ) . toHaveBeenCalledTimes ( 1 )
100
119
} )
0 commit comments