Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Disable
settings.shadow.defaultPresets
for classic themes #6309Disable
settings.shadow.defaultPresets
for classic themes #6309Changes from 14 commits
e1dd97f
f838ba3
4cc07b0
43bddac
9006ad2
ce570a5
3845b40
9e13987
f4fa539
b4932d2
99e8d0e
cb9c2f7
c35f2dd
522ff61
1aa93a7
feec02d
9888800
7955b41
c32ceb3
064b549
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check failure on line 1085 in tests/phpunit/tests/theme/wpThemeJsonResolver.php
GitHub Actions / PHP coding standards
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.
It might be helpful to assert specifically that the
natural
present has not been overriden by the Theme version fromblock-theme
'stheme.json
.The original bug related to the theme presets with the same slug overriding the core presets so it might be good to specifically assert to focus the test on this aspect.
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.
Maybe also include a reference to the location of the related core preset?
wordpress-develop/src/wp-includes/theme.json
Lines 196 to 200 in f25ca58
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 value would never be overridden. What would happen instead is that
theme
array would have thenatural
preset. You may want to check by settingshadow.defaultPresets:false
in core's theme.json and then executenpm run test:php -- --filter test_theme_shadow_presets_do_not_override_default_shadow_presets
.Note that I've also added a theme preset that is actually added (
test
) to make sure this is also working.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.
Essentially, presets work this way:
theme.json
sources (default, theme, user) are merged, all the values are available under the source key. For example:shadows
, resulting in the following:This is the base behavior for all presets. From there, this data is used differently by the components:
default
andtheme
array will be converted to--wp--preset--category--slug
(e.g.:--wp--preset--shadow-natural
). This was the issue Alex raised and that is fixed by this PR.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 the additional clarification. I was understanding correctly, but perhaps not communicating that understanding very well.
When I say "overridden" I mean that the bug was that the Theme preset would take precedence over the Core preset.
Now with this PR the Core preset takes precedence over the Theme preset.
The condition is that they must have a matching slug. This is why you've added a "Test" preset that only exists in the Theme to verify that this functionality still works.
Check failure on line 1148 in tests/phpunit/tests/theme/wpThemeJsonResolver.php
GitHub Actions / PHP coding standards