Background image block support: Add tests, adjust injection logic slightly#54489
Conversation
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ phpunit/block-supports/background-test.php ❔ lib/block-supports/background.php |
|
Flaky tests detected in 5899a63. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6194420786
|
ramonjd
left a comment
There was a problem hiding this comment.
Tests and changes to block-supports/background.php match Core
Tests pass 👍🏻
Tested background image using a Group block with border and some other styles. Editor and frontend match.
🚀
|
Thanks for the review! 🙇 |
|
✅ I updated the PHP Sync Tracking Issue for WP 6.5 to note this PR does not require a backport for WP 6.5. |
What?
Part of: #54336
Add PHP tests for the background image block support.
Also, adjust the style injection slightly, so that if the existing style attribute ends in a semi-colon, we still inject the newly created styles.
Why?
While working on the backport for the background image block support over in WordPress/wordpress-develop#5209, I added some tests, and noticed the logic for injecting the style tag needed adjusting slightly. While in Gutenberg, inline styles don't include a trailing semi-colon, I thought it'd be good to factor it in, just in case, for the future reliability of the support and interacting with other styles.
Also, it's good to add tests for features!
How?
Testing Instructions
npm run test:unit:php:base -- --filter WP_Block_Supports_Background_Testlocally to confirm.