Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard - Check for window existence in afterAll functions #1178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EgoziE
Copy link

@EgoziE EgoziE commented Nov 14, 2023

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
  • 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 💛

Copy link

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 34c2965:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration

@EgoziE
Copy link
Author

EgoziE commented Nov 14, 2023

I didn't notice, it's almost a copy of #1176
Please accept either PR 🙏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant