-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UnitControl
: mark unit
prop as deprecated
#39503
Conversation
Size Change: +75 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
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
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 😃
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 <mr.fye@oneandthesame.net>
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 <mr.fye@oneandthesame.net> * Use `in` operator to check if the deprecated `unit` prop is passed to `UnitControl` Co-authored-by: Mitchell Austin <mr.fye@oneandthesame.net>
What?
In the context of #35744, this PR marks the
unit
prop inUnitControl
as deprecated.Note: these changes only apply to the web version of
UnitControl
(the native version is still relying on theunit
prop at the time of working on this PR).Note: this PR requires that all usages of the
UnitControl
component (web version) are refactored to avoid using theunit
prop:FocalPointPicker
: stop usingUnitControl
's deprecatedunit
prop #39504BoxControl
: stop usingUnitControl
's deprecatedunit
prop #39511Spacer
block: stop usingUnitControl
's deprecatedunit
prop #39513Search
block: stop usingUnitControl
's deprecatedunit
prop #39514Cover
block: stop usingUnitControl
's deprecatedunit
prop #39522BorderRadiusControl
: Stop usingUnitControl
’s deprecatedunit
prop #39549Why?
The unit prop was marked as deprecated in the README, but this was not reflected in the docs
How?
unit
prop as@deprecated
in the TypeScript typesTesting Instructions
No runtime/behavioral changes: