React.addons.TestUtils.Simulate.scroll is not working with JSDOM
See original GitHub issueHi, I’m trying to test the scroll event and I could not make the scroll event propagation to happen using TestUtils:
React.addons.TestUtils.Simulate.scroll(contentDiv, { deltaY: 500 });
The above code is never triggering the scroll function callback. Then if I change the implementation to be something like this it works:
contentDiv.scrollTop = 500;
var evt = document.createEvent("HTMLEvents");
evt.initEvent("scroll", false, true);
contentDiv.dispatchEvent(evt);
Am I doing something wrong with the React TestUtils? I’ve created a stackoverflow ticket for this.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:7
- Comments:6 (3 by maintainers)
Top Results From Across the Web
React.addons.TestUtils.Simulate.scroll is not working
Simulate.scroll() only simulates a scroll event dispatched by a specific React component (e.g. when you have overflow: scroll set on that component) and ......
Read more >React.addons.TestUtils.Simulate.scroll is not working with JSDOM
Hi, I'm trying to test the scroll event and I could not make the scroll event propagation to happen using TestUtils: React.addons.TestUtils.
Read more >Test Utilities - React
ReactTestUtils makes it easy to test React components in the testing framework of your choice. At Facebook we use Jest for painless JavaScript...
Read more >React.addons.TestUtils.Simulate.scroll is not working-Reactjs
I realized the crux of my problem was that TestUtils.Simulate.scroll() only simulates a scroll event dispatched by a specific React component (e.g. when...
Read more >react-addons-test-utils | Yarn - Package Manager
This solves an issue that already exists in React 17 and below, but is even more important in React 18 because React yields...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guys any activity on that issue? Currently has a trouble to test my own infinite scroll component.
If there was any activity you would see it on the issue 😉 . With an issue like this, the best way to fix it is to dive into why it happens and send a PR to the project.