-
Notifications
You must be signed in to change notification settings - Fork 4.6k
UI: Remove redundant renderElement utility #74284
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
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 09a425d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20604597708
|
mirka
left a comment
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.
Nice cleanup 👍
| jest.mock( './style.module.css', () => ( { | ||
| stack: 'stack-class', | ||
| } ) ); |
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.
I feel weird about testing the class merging like this. It's tied to an implementation detail, and is somewhat overtesting what I think we can trust the Base UI utility to handle.
Also I think it's actually hard to forward consumer-passed className/style props in a way that overwrites the respective props set by us, without triggering a TS error. So in that sense, it might be sufficient to check for prop forwarding, and not worry about the merging.
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.
Yeah, originally I didn't have this and only added it later in 09a425d . I agree that we should be able to trust the utility to handle this, but there's also the potential for error in whether we're using it and whether we're using it correctly (which, for the record, we were not using it correctly prior to 09a425d, which fixed a subtle bug with duplicate class names). I also agree that this is very "open box" testing in mocking the exports of the dependency. I don't feel particularly strongly, so maybe it's fine to remove.
What?
Updates
@wordpress/uipackage to remove its internalrenderElementutility, and update usage to use equivalent Base UI utilities available since #74190.Why?
Testing Instructions
Verify tests pass, as both affected components have test coverage verifying props merging (added for
Stackas part of the changes here):Verify Storybook stories for Box and Stack:
npm run storybook:dev