Closed gwBear1 closed 3 months ago
See also:
The issue is upstream in JSDom not supporting the event properly.
There is somewhat of a workaround in the comments https://github.com/jsdom/jsdom/issues/2527#issuecomment-1488182727 (though with likely caveats).
Alternative workarounds are around trying a different DOM implementation (e.g. happy-dom
- haven't tested so might not be workable), or hoisting these tests to a browser environment such as using Playwright (of course, if applicable / practical for your use-case).
Thanks for finding this one @jlp-craigmorten :) I'm closing this issue in favor of the JSDOM one.
@testing-library/dom
version:^9.3.4
^26.6.3
Relevant code or config:
What you did:
fireEvent does not fire the pointer event such as
onpointerup
,onpointerdown
What happened:
fireEvent does not fire the pointer event such as
onpointerup
,onpointerdown
Reproduction:
const tempPointer = document.createElement('div') tempPointer.onpointerup = () => { console.log('run2') } tempPointer.dispatchEvent(new PointerEvent('pointerup')) // 'run' will be shown
Problem description:
Suggested solution:
Should work pointer event same as browser.