-
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
Global Styles: Allow referenced zero value and simplify getValueFromObjectPath calls #64836
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. |
Size Change: -11 B (0%) Total Size: 1.77 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.
Good spotting. Makes sense to let getValueFromObjectPath
do it's thing!
I also tested with 0
values in theme.json and a ref pointing to it. CSS was output correctly in the editor. 💯
…bjectPath calls (WordPress#64836) Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: ramonjd <[email protected]>
What?
A few minor code quality tweaks for global styles util functions.
Why?
Bottle pickup during an exploration into style inheritance.
How?
getValueFromObjectPath
can accept a string or array for the object path. Let the function do its thing to make the consumer code a touch more concise.ref
values by explicitly checking forundefined
. This allows referenced integer zero values.The existing unit tests already have coverage related to the calls to
getValueFromObjectPath
in the affected utils. A new test case was added forgetResolvedRefValue
to ensure referenced zero integer values were successfully returned.Testing Instructions
i. Add a zero integer value for a block type's padding in theme.json
ii. Define a style for a second block type or padding side that references the zero integer value
iii. Load up global styles and ensure that the reference zero value displays
Screenshots or screencast