how to create a mouse event with clientX and clientY defined

Viewed 150

Dear all hoping that someone can give me a way to resolve or document this subject. I try to do something like that in one of my tests : const event = new window.MouseEvent('contextmenu',{clientX: 24,clientY: 42});

I want to initialize x and y to verify that my contextual menu has good top and left values. In my code I'm using pageX and pageY ... and even if I replace the client with the page nothing happens. In fact, I know how to initialize custom events with {detail: value} dictionary but for MouseEventInit dictionary I don't know the good structure?

I call the event like this: await unit.dispatchEvent(event); the await is only because I have some promise resolution inside the event function.

0 Answers
Related