Open electroluxcode opened 1 month ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 5cda1a3c7d57ae624ccd46edc44e992342179353:
Sandbox | Source |
---|---|
react-testing-library-examples | Configuration |
fix https://github.com/testing-library/dom-testing-library/issues/1327
this pr is about mock brower event, it is a possible solutions to the https://github.com/testing-library/dom-testing-library/issues/1327) issues
What: This PR adds two new lifecycle methods,
before
andcond
, developers only need to control these two lifecycles to simulate most browser behaviors.. on top of the existing ones to simulate browser events. This is just a draft; please do not merge.Why:
The events in dom-testing-library are encapsulated based on the native Event class. However, when there are conflicts between this Event and native DOM events, it may not fully replicate the behavior.
How:
Checklist:
before this pr, it will trigger
dragstar
anddragover
event ,it is error because dragstart is prevent,it should only triggerdragstart
event after this pr ,when i test this case ,it 'll be as expect