-
-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Labels
Description
Description
Although it seams possible to add an event to dispatchMouseEvent this is only possible by redefinig the type of the event
Consider this code
const mouseEvent = createMouseEvent('click');
const onEventSpy = jest.spyOn(mouseEvent, 'stopPropagation');
spectator.dispatchMouseEvent('button', mouseEvent);
expect(onEventSpy).toHaveBeenCalled();
Currently you would have to add all other parameters to dispatchMouseEvent
Proposed solution
Create a dispatchEvent method to spectator, that allows dispatching an formaly created events.
OR
Change dispatchMouseEvent to allow adding a mouseEvent as second parameter instead of string.
Alternatives considered
None
Do you want to create a pull request?
Yes