-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[core] Replace enzyme in describeConformance #42447
[core] Replace enzyme in describeConformance #42447
Conversation
Netlify deploy previewhttps://deploy-preview-42447--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
b711d40
to
c329f67
Compare
c486d38
to
81f9574
Compare
|
||
expect(root.props()).to.have.property(testProp, value); | ||
expect(getByTestId(testId)).to.have.attribute(testProp, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we lose the aspect of testing that the inherited component is being used and only maintain that the props are spread into whatever the component considers its root.
This follows RTL's principle of not testing implementation details. There might be a way for us to test that the inherited component is the one used, but I think it would be better to test that on each component's tests, by testing the expected functionality, classes, or whatever the inherited component provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this is mostly used by the doc gen to add a message about additional props available on a component. I'm strongly in favor of removing this message and listing all available props on each component, so it's not necessary to jump between the pages to learn about available props. Afterwards, this test may be unnecessary.
Not in this PR, of course :)
@@ -269,6 +268,25 @@ function testSlotPropsProp( | |||
}); | |||
} | |||
|
|||
function testClassName(element: React.ReactElement, getOptions: () => ConformanceOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required as Base UI's describeConformance
accepts async render functions. We could support those in the basic describeConformance
test, but I wanted to keep the changes minimal, especially considering this base code is stale. Let me know if making the original testClassName
async would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async render functions will be required when Material UI uses Floating UI. Certain interactions require flushing the microtask queue, which is an async operation. This is not strictly required now, so I agree it's ok to minimize the number of changes in this PR.
@DiegoAndai just ran the This is solved via 117cf8a and now all There are several failures when running all unit tests with |
ac2582a
to
117cf8a
Compare
I just rebased to solve CI issues. |
@DiegoAndai after updating all React related deps in all the repo packages, After fixing the first error (just an import path update), we'll need to deal with other deprecations. I think we should take care of this in #42047. |
Thanks for picking this up @aarongarciah
Yes, many things must be fixed, but I want to keep this PR scoped in @LukasTy we're ready to merge this on our side, what about from the MUI X side? |
@LukasTy In mui/mui-x#13360 I've updated |
@DiegoAndai Everything looks good on the MUI X side: mui/mui-x#13360 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all the effort on it. 🙏
The solution looks great.
I've updated the mui/mui-x#12295 PR with the latest package from this PR and made some cleanup changes for things that are no longer used like this in this PR. 😉
For some reason all tests passed in CI but 37 tests fail locally when running |
117cf8a
to
3a6ae48
Compare
@aarongarciah Could be related to #42670. |
After a rebase all tests pass locally. We had a regression causing tests to not run in CI but now that's fixed. More info https://mui-org.slack.com/archives/C042YB5RB3N/p1718610795073829 |
Co-authored-by: Aarón García Hervás <[email protected]>
Part of #42454
This PR removes
createMount
from thedescribeConformance
testing utility. Some notes: