@@ -119,6 +119,7 @@ const eventTypes = [
119
119
elementType : 'div' ,
120
120
} ,
121
121
]
122
+
122
123
beforeEach ( ( ) => {
123
124
jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
124
125
} )
@@ -215,6 +216,26 @@ test('fireEvent.update does not trigger warning messages', async () => {
215
216
expect ( console . warn ) . not . toHaveBeenCalled ( )
216
217
} )
217
218
219
+ test ( 'fireEvent.update should not crash with input file' , async ( ) => {
220
+ const { getByTestId} = render ( {
221
+ template : `<input type="file" data-testid="test-update" />` ,
222
+ } )
223
+
224
+ const file = new File ( [ '(⌐□ しろいしかく _□ しろいしかく )' ] , 'chucknorris.png' , { type : 'image/png' } )
225
+
226
+ const inputEl = getByTestId ( 'test-update' )
227
+
228
+ // You could replace the lines below with
229
+ // userEvent.upload(inputEl, file)
230
+ Object . defineProperty ( inputEl , 'files' , {
231
+ value : [ file ] ,
232
+ } )
233
+
234
+ await fireEvent . update ( inputEl )
235
+
236
+ expect ( console . warn ) . not . toHaveBeenCalled ( )
237
+ } )
238
+
218
239
test ( 'fireEvent.update does not crash if non-input element is passed in' , async ( ) => {
219
240
const { getByText} = render ( {
220
241
template : `<div>Hi</div>` ,
0 commit comments