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

FireEvent on Window #165

Merged

Conversation

VadimBrodsky
Copy link
Contributor

What:

Change the typings for fireEvent to accept Window in addition to DOM Elements.

Why:

Some events such postMessage are not fired on a DOM element but rather on Window.

How:

  • Updated typings
  • Add test
  • Expose window to the test environment

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@VadimBrodsky VadimBrodsky changed the title Pr/fireevent on window FireEvent on Window Dec 4, 2018
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool 👍 thanks!

@kentcdodds kentcdodds merged commit 8ca67fe into testing-library:master Dec 4, 2018
@kentcdodds
Copy link
Member

🎉 This PR is included in version 3.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dbismut
Copy link
Contributor

dbismut commented Apr 16, 2019

Hi @VadimBrodsky, I don't know if this PR was supposed to fix this, but at the moment I'm having an error when doing this:

 fireEvent.mouseMove(window, { clientX: 20, clientY: 50 })

Console throws:
TypeError: Cannot read property 'MouseEvent' of undefined

It works fine when using document instead of window.

This is using [email protected] which itself should be using dom-testing-library@^3.19.0

@kentcdodds
Copy link
Member

Hmmm... Could you open a PR with a failing test? Thanks!

@dbismut
Copy link
Contributor

dbismut commented Apr 17, 2019

Hey @kentcdodds here is a csb link with a failing test:
https://codesandbox.io/s/3kxw3q8z8m

Does that help?

@kentcdodds
Copy link
Member

Got it. I'll have a fix shortly.

kentcdodds pushed a commit that referenced this pull request Apr 17, 2019
@kentcdodds
Copy link
Member

A fix will be released in a minute.

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

Successfully merging this pull request may close these issues.

3 participants