File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,8 @@ test('assigns read-only target properties', () => {
383
383
384
384
expect ( node . scrollWidth ) . toBe ( 0 )
385
385
fireEvent . scroll ( node , { target : { scrollWidth : 10 } } )
386
+
387
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 )
386
388
expect ( node . scrollWidth ) . toBe ( 10 )
387
389
} )
388
390
Original file line number Diff line number Diff line change @@ -46,14 +46,13 @@ function createEvent(
46
46
} )
47
47
}
48
48
49
- const modifiableProperties = { }
49
+ // Make read-only properties of events specifiable for tests.
50
50
Object . keys ( targetProperties ) . forEach ( key => {
51
- modifiableProperties [ key ] = {
51
+ Object . defineProperty ( node , key , {
52
52
value : targetProperties [ key ] ,
53
53
writable : true ,
54
- }
54
+ } )
55
55
} )
56
- Object . defineProperties ( node , modifiableProperties )
57
56
58
57
const window = getWindowFromNode ( node )
59
58
const EventConstructor = window [ EventType ] || window . Event
You can’t perform that action at this time.
0 commit comments