I noticed we stopped providing it, but a bunch of fiddles for old bugs use it.
I wonder if we should add it back, e.g. as react-dom-test-utils.development.js.
Let鈥檚 hear what people have to say.
@gaearon: I'm currently blocked on upgrading our application to React 16 due to the lack of a UMD build of TestUtils. Shall I compile one and submit a PR?
Can you describe your use case in more detail? Why do you need a UMD build of something intended only for testing?
Our application is non-trivially large, and module systems that involve transpiling our JS are unworkably slow. We used to use Webpack but cut it because it was taking 40 seconds plus for every development build (after Typescript as well).
We have no choice but to use UMD if we don't want to wait multiple minutes every time we make any script change in development.
What @markboyall said :+1:
OK that sounds reasonable. Happy to take a PR.
@gaearon: done (https://github.com/facebook/react/pull/11599) :+1:
Any workarounds for using .renderIntoDocument() in tools like CodePen with react@16?
All renderIntoDocument does is create a div and call ReactDOM.render into it.
var div = document.createElement('div');
ReactDOM.render(<App />, div);
Just use it directly.
What about Simulate?
In general I recommend simulating real DOM events instead of using Simulate API.
For example, if the node is in a document (that's important!):
node.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}));
But again, as per feedback in this issue, we'll add a UMD build for TestUtils in later versions again.
Didn't saw this recommendation in React Docs. Thank you.
Yep, we'll need to document this. I'll file an issue for the doc repo.
Most helpful comment
OK that sounds reasonable. Happy to take a PR.