Fix to make tests compatible with Material UI v3 and v4 #832
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.
I've made 2 small tweaks that allow the tests to work on both Material UI v3 and v4. In this PR I only change the tests and not the package.json or package-lock.json files (more on that below). Steps to test:
I didn't update package.json and package-lock.json since I figure it's in the cards to do that later down the road - though I'll note that I've been using the table with MUI v4 and I haven't seen any issues, though I know there are a few small things, ex: #595 #676).
Let me know if I'm overwhelming you with PRs, I'm going to be pretty busy after this coming Friday, so this will most likely be my last one for a while.
Anyway, while doing one of my other PRs I noticed the tests didn't work in MUI v4. I decided to look into it, and it appears to be because the MUI folks are doing instanceOf checks for HTMLInputElement [1] and Element [2], which the tests look for on the global object (since the MUI code assumes they're in the global scope). Attaching them to the global object allows 24 of the failing tests to pass when run under Material v4 (and to still work under v3).
I fixed the last remaining test by allowing "ForwardRef(Paper)" to also be a valid value. I toyed around with the dive().name calls, and it looks like something just changed under the hood to make it so it became "ForwardRef(Paper)" in newer versions of the framework.
[1] https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Popover/Popover.js#L144
[2] https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/InputBase/InputBase.js#L197