Add tests for the Draggable component when rendered into an iframe #182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add tests for #180 (all passing ✅ )
Note that I was unable to get these tests working using TestUtils’
renderIntoDocument
function (or the variousfind*
helpers) and had to use actualReactDOM.render
along withquerySelector
on the returned DOM node to make assertions on the rendered results. Has something to do with the tricky parts of react-frame-component (rendering an iframe with React), and looking at the react-frame-component tests, they take the same approach.As a result of needing to use ReactDOM.render, I had to add a setTimeout before selecting the rendered nodes from the DOM to avoid the tests breaking in Firefox. Here’s the error I saw when I tried to select the nodes synchronously:
I had another weird seemingly unrelated test failure on Firefox that I worked around by rounding the mouse event’s
deltaY
in the onDrag function’s assertions. Here’s that error: