Clipboard - Check for window existence in `afterAll` functions
What:
Added a verification that window exists in functions resetClipboardStubOnView and detachClipboardStubFromView which are called on afterAll.
Why: When testing in SSR environment, window does (and should) not exist, therefore my tests fail.
How: Just added a conditional chaining.
Checklist:
- [ ] Documentation
- [ ] Tests
- [x] Ready to be merged
I believe these functions should not be called in afterAll at all unless the user is actively using clipboard functionality.
Thanks 💛
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 34c29652d9fb9d1cfdd60669d8878a50c3d89148:
| Sandbox | Source |
|---|---|
| userEvent-dom | Configuration |
| userEvent-react | Configuration |
I didn't notice, it's almost a copy of https://github.com/testing-library/user-event/pull/1176 Please accept either PR 🙏🏼
resolved by #1176