()
| 14 | * Enables reading pageX/pageY from fireEvent.mouse*(..., {pageX: ..., pageY: ...}). |
| 15 | */ |
| 16 | export function installMouseEvent(): void { |
| 17 | let oldMouseEvent = MouseEvent; |
| 18 | beforeAll(() => { |
| 19 | global.MouseEvent = class FakeMouseEvent extends MouseEvent { |
| 20 | _init: {pageX: number; pageY: number}; |
| 21 | constructor(name, init) { |
| 22 | super(name, init); |
| 23 | this._init = init; |
| 24 | } |
| 25 | get pageX() { |
| 26 | return this._init.pageX; |
| 27 | } |
| 28 | get pageY() { |
| 29 | return this._init.pageY; |
| 30 | } |
| 31 | }; |
| 32 | }); |
| 33 | afterAll(() => { |
| 34 | global.MouseEvent = oldMouseEvent; |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | export function definePointerEvent(): void { |
| 39 | // @ts-ignore |
no outgoing calls
no test coverage detected