-
Notifications
You must be signed in to change notification settings - Fork 4.6k
UnitControl: mark unit prop as deprecated
#39503
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
Conversation
|
Size Change: +75 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
stokesman
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.
Looks and tests fine for me.
d055c30 to
d75a6be
Compare
andrewserong
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.
Thanks for the follow-up with all the one-off PRs! This is testing nicely for me @ciampo, the UnitControl component behaves as it does on trunk in Storybook and within the instances in the editor that I tested. If I manually add a unit prop to e.g. the height control in the Spacer block, then when the component is mounted I get the following warning in the console 👍
A non-blocking question: I was wondering if it's worth retaining at least one unit test that tests that the deprecated unit prop still works, but then also check that the warning is generated (e.g. via expect( console ).toHaveWarnedWith()). Probably not a huge issue, but this would be a test to ensure that we don't accidentally remove the feature during its status as "still working but deprecated". I'm not too sure how frequently we have those sorts of tests in the Gutenberg repo? (I couldn't find many examples outside of the deprecated package), but just thought I'd raise the question 😃
aaronrobertshaw
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 work tying up all the loose ends with the UnitControl @ciampo 👍
This is testing well for me.
✅ Code changes LGTM
✅ Readme and types match in terms of deprecating unit prop
✅ Unit tests pass
✅ Deprecation warning thrown when adding unit prop (tested via cover block min-height and storybook examples)
✅ Couldn't see any functional differences between this PR and trunk
I was wondering if it's worth retaining at least one unit test that tests that the deprecated unit prop still works, but then also check that the warning is generated
This sounds like a good idea for a follow-up to me.
Co-authored-by: Mitchell Austin <[email protected]>
d75a6be to
ebf89dd
Compare
Good point, will do 👌 |
* `UnitControl`: mark `unit` prop as deprecated * Update 's unit tests * CHANGELOG * Update comment Co-authored-by: Mitchell Austin <[email protected]> * Use `in` operator to check if the deprecated `unit` prop is passed to `UnitControl` Co-authored-by: Mitchell Austin <[email protected]>

What?
In the context of #35744, this PR marks the
unitprop inUnitControlas deprecated.Note: these changes only apply to the web version of
UnitControl(the native version is still relying on theunitprop at the time of working on this PR).Note: this PR requires that all usages of the
UnitControlcomponent (web version) are refactored to avoid using theunitprop:FocalPointPicker: stop usingUnitControl's deprecatedunitprop #39504BoxControl: stop usingUnitControl's deprecatedunitprop #39511Spacerblock: stop usingUnitControl's deprecatedunitprop #39513Searchblock: stop usingUnitControl's deprecatedunitprop #39514Coverblock: stop usingUnitControl's deprecatedunitprop #39522BorderRadiusControl: Stop usingUnitControl’s deprecatedunitprop #39549Why?
The unit prop was marked as deprecated in the README, but this was not reflected in the docs
How?
unitprop as@deprecatedin the TypeScript typesTesting Instructions
No runtime/behavioral changes: