Skip to content
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

Backport changes from gutenberg#46896 for 6.3 #4664

Closed

Conversation

madhusudhand
Copy link

This PR adds the PHP changes for the following Gutenberg PRs:

WordPress/gutenberg#46896

There are no front-end changes in this PR.

Testing instructions:

  • Enable supports for blocks such as post-title

src/wp-includes/blocks/post-title/block.json

{
...
"supports": {
  "shadow": true,
  ...
}

In the theme template add shadow attribute as follows.

<!-- wp:post-title {"shadow":"natural"} /-->

Verify the post title UI to have the applied shadow.

image

@spacedmonkey
Copy link
Member

Please ensure that any change comes with a PHPUnit test.

@ramonjd
Copy link
Member

ramonjd commented Jun 23, 2023

@madhusudhand

Thanks for adding this patch.

You can add the following test to tests/phpunit/tests/style-engine/styleEngine.php

diff --git a/tests/phpunit/tests/style-engine/styleEngine.php b/tests/phpunit/tests/style-engine/styleEngine.php
index 616c332095..6ef8700760 100644
--- a/tests/phpunit/tests/style-engine/styleEngine.php
+++ b/tests/phpunit/tests/style-engine/styleEngine.php
@@ -181,6 +181,19 @@ class Tests_wpStyleEngine extends WP_UnitTestCase {
 				),
 			),
 
+			'inline_valid_shadow_style'                => array(
+				'block_styles'    => array(
+					'shadow' => 'inset 5em 1em gold',
+				),
+				'options'         => null,
+				'expected_output' => array(
+					'css'          => 'box-shadow:inset 5em 1em gold;',
+					'declarations' => array(
+						'box-shadow' => 'inset 5em 1em gold',
+					),
+				),
+			),
+
 			'inline_valid_typography_style'                => array(
 				'block_styles'    => array(
 					'typography' => array(

The new block supports will need a test in tests/phpunit/tests/block-supports/shadow.php

You can probably use one of the existing block supports test files as a guide, e.g., spacing.php

Let us know if you need help.

ramonjd added a commit to ramonjd/wordpress-develop that referenced this pull request Jun 26, 2023
@ramonjd
Copy link
Member

ramonjd commented Jun 26, 2023

I've continued these changes in this PR over here:

And have added some test coverage

Thank you @madhusudhand !!!

@tellthemachines
Copy link
Contributor

Closing in favour of #4696.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

4 participants