File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,22 @@ test('assigns clipboardData properties', () => {
358
358
expect ( clipboardData . getData ( 'text' ) ) . toBe ( 'example' )
359
359
} )
360
360
361
+ test ( 'assigns TransitionEvent init properties' , ( ) => {
362
+ const node = document . createElement ( 'div' )
363
+ const spy = jest . fn ( )
364
+ node . addEventListener ( 'transitionend' , spy )
365
+ const transitionEventInit = {
366
+ propertyName : 'opacity' ,
367
+ elapsedTime : 100 ,
368
+ pseudoElement : '' ,
369
+ }
370
+ fireEvent . transitionEnd ( node , transitionEventInit )
371
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 )
372
+ expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual (
373
+ expect . objectContaining ( transitionEventInit ) ,
374
+ )
375
+ } )
376
+
361
377
test ( 'fires events on Window' , ( ) => {
362
378
const messageSpy = jest . fn ( )
363
379
window . addEventListener ( 'message' , messageSpy )
Original file line number Diff line number Diff line change @@ -62,6 +62,19 @@ function createEvent(
62
62
} )
63
63
}
64
64
65
+ // TransitionEvent is not supported in jsdom: https://github.com/jsdom/jsdom/issues/1781
66
+ if ( EventType === 'TransitionEvent' ) {
67
+ const transitionEventProperties = [
68
+ 'propertyName' ,
69
+ 'elapsedTime' ,
70
+ 'pseudoElement' ,
71
+ ]
72
+ transitionEventProperties . forEach ( property => {
73
+ const value = eventInit [ property ]
74
+ Object . defineProperty ( event , property , { value} )
75
+ } )
76
+ }
77
+
65
78
// DataTransfer is not supported in jsdom: https://github.com/jsdom/jsdom/issues/1568
66
79
const dataTransferProperties = [ 'dataTransfer' , 'clipboardData' ]
67
80
dataTransferProperties . forEach ( dataTransferKey => {
You can’t perform that action at this time.
0 commit comments