import { ModifierKeys } from '@angular/cdk/testing' ; function createMouseEvent ( type , clientX = 0 , clientY = 0 , button = 0 , modifiers = { } , relatedTarget ? ) { const event = document . createEvent ( 'MouseEvent' ) ; const originalPreventDefault = event . preventDefault . bind ( event ) ; const screenX = clientX ; const screenY = clientY ; event . initMouseEvent ( type , true , true , window , 0 , screenX , screenY , clientX , clientY , ! ! modifiers . control , ! ! modifiers . alt , ! ! modifiers . shift , ! ! modifiers . meta , button , relatedTarget ) ; defineReadonlyEventProperty ( event , 'buttons' , 1 ) ; event . preventDefault = function ( ) { defineReadonlyEventProperty ( event , 'defaultPrevented' , true ) ; return originalPreventDefault ( ) ; } ; return event ; } function defineReadonlyEventProperty ( event , propertyName , value ) { Object . defineProperty ( event , propertyName , { get : ( ) => value , configurable : true } ) ; } export function dispatchEvent < T extends Event > ( node , event ) { node . dispatchEvent ( event ) ; return event ; } export function dispatchMouseEvent ( node , type , clientX = 0 , clientY = 0 , button ? , modifiers ? , relatedTarget ? ) { return dispatchEvent ( node , createMouseEvent ( type , clientX , clientY , button , modifiers , relatedTarget ) ) ; }