Created
November 28, 2018 22:29
-
-
Save aautar/d331d742fd07dc4de4f52f5af9439673 to your computer and use it in GitHub Desktop.
Simulate DOM event within a Jest test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://github.com/facebook/react/issues/3249#issuecomment-177750141 | |
var event = document.createEvent("HTMLEvents"); | |
event.initEvent("click", true, true); | |
var target = $('.about-page-link')[0]; | |
target.dispatchEvent(event); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment