Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui] Make tests compatible with React 19 #43155

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

DiegoAndai
Copy link
Member

@DiegoAndai DiegoAndai commented Aug 2, 2024

Part of: #42824

Adapt to React 19 in our tests. Most of the changes are explained by either:

For the ones that are not explained by these changes, I left comments on.

These commits were cherry-picked from #42824.

@DiegoAndai DiegoAndai added package: material-ui Specific to @mui/material React 19 support PRs required to support React 19 labels Aug 2, 2024
@DiegoAndai DiegoAndai self-assigned this Aug 2, 2024
@mui-bot
Copy link

mui-bot commented Aug 2, 2024

Netlify deploy preview

https://deploy-preview-43155--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against ff53059

Comment on lines 3006 to 3009
const expectedCallHistory =
reactMajor === 19 ? [null, 'one', 'one', 'four'] : [null, 'one', 'four'];

expect(handleHighlightChange).to.deep.equal(expectedCallHistory);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this one (or the similar one for joy) happened, might be something related to the Strict mode changes, but the explanation on the upgrade guide is not very detailed.

@DiegoAndai DiegoAndai requested review from mnajdova, michaldudak and aarongarciah and removed request for mnajdova and michaldudak August 2, 2024 19:33
Copy link
Member

@aarongarciah aarongarciah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left some comments, most of them directed at making tests a bit more future-proof by checking for reactMajor >= 19 instead of reactMajor === 19 so we don't need to modify tests once React 20 is out (if no specific changes affect the tests, of course).

packages-internal/test-utils/src/index.ts Show resolved Hide resolved
packages-internal/test-utils/src/index.ts Show resolved Hide resolved
packages/mui-joy/src/Autocomplete/Autocomplete.test.tsx Outdated Show resolved Hide resolved
packages/mui-joy/src/Autocomplete/Autocomplete.test.tsx Outdated Show resolved Hide resolved
packages/mui-material/src/Select/Select.test.js Outdated Show resolved Hide resolved
packages/mui-styles/src/makeStyles/makeStyles.test.js Outdated Show resolved Hide resolved
@DiegoAndai
Copy link
Member Author

@aarongarciah I implemented the future-proofing changes for future React versions, and replied to the other questions

Copy link
Member

@aarongarciah aarongarciah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing ✨

@DiegoAndai DiegoAndai merged commit 562d662 into mui:next Aug 5, 2024
19 checks passed
@DiegoAndai DiegoAndai deleted the react-19-compatible-tests branch August 5, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: material-ui Specific to @mui/material React 19 support PRs required to support React 19
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants