File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 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', () => {
383383
384384 expect ( node . scrollWidth ) . toBe ( 0 )
385385 fireEvent . scroll ( node , { target : { scrollWidth : 10 } } )
386+
387+ expect ( spy ) . toHaveBeenCalledTimes ( 1 )
386388 expect ( node . scrollWidth ) . toBe ( 10 )
387389} )
388390
Original file line number Diff line number Diff line change @@ -46,14 +46,13 @@ function createEvent(
4646 } )
4747 }
4848
49- const modifiableProperties = { }
49+ // Make read-only properties of events specifiable for tests.
5050 Object . keys ( targetProperties ) . forEach ( key => {
51- modifiableProperties [ key ] = {
51+ Object . defineProperty ( node , key , {
5252 value : targetProperties [ key ] ,
5353 writable : true ,
54- }
54+ } )
5555 } )
56- Object . defineProperties ( node , modifiableProperties )
5756
5857 const window = getWindowFromNode ( node )
5958 const EventConstructor = window [ EventType ] || window . Event
You can’t perform that action at this time.
0 commit comments