@@ -271,6 +271,23 @@ public function data_background_block_support() {
271271 'expected_wrapper ' => '<div class="has-background" style="background-image:linear-gradient(135deg,hsl(0,100%,50%) 0%,hsl(240,100%,50%) 100%), url( ' . $ apos . 'https://example.com/image.jpg ' . $ apos . ');background-size:cover;">Content</div> ' ,
272272 'wrapper ' => '<div>Content</div> ' ,
273273 ),
274+ 'background gradient is applied without the image when the image skips serialization ' => array (
275+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
276+ 'block_name ' => 'test/background-image-skipped-gradient-applied ' ,
277+ 'background_settings ' => array (
278+ 'backgroundImage ' => true ,
279+ 'gradient ' => true ,
280+ '__experimentalSkipSerialization ' => array ( 'backgroundImage ' ),
281+ ),
282+ 'background_style ' => array (
283+ 'backgroundImage ' => array (
284+ 'url ' => 'https://example.com/image.jpg ' ,
285+ ),
286+ 'gradient ' => 'linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%) ' ,
287+ ),
288+ 'expected_wrapper ' => '<div class="has-background" style="background-image:linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%);">Content</div> ' ,
289+ 'wrapper ' => '<div>Content</div> ' ,
290+ ),
274291 'background image style is not applied if the block does not support background image ' => array (
275292 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
276293 'block_name ' => 'test/background-rules-are-not-output ' ,
@@ -478,6 +495,32 @@ public function data_get_background_classes_and_styles() {
478495 'style ' => 'background-clip:padding-box;-webkit-text-fill-color:currentColor; ' ,
479496 ),
480497 ),
498+ 'image clipped to text has no class ' => array (
499+ 'block_attributes ' => array (
500+ 'style ' => array (
501+ 'background ' => array (
502+ 'backgroundImage ' => array ( 'url ' => 'https://example.com/image.jpg ' ),
503+ 'backgroundClip ' => 'text ' ,
504+ ),
505+ ),
506+ ),
507+ 'expected ' => array (
508+ 'style ' => "background-image:url('https://example.com/image.jpg');background-size:cover;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent; " ,
509+ ),
510+ ),
511+ 'image without url gets default size ' => array (
512+ 'block_attributes ' => array (
513+ 'style ' => array (
514+ 'background ' => array (
515+ 'backgroundImage ' => array ( 'id ' => 1 ),
516+ ),
517+ ),
518+ ),
519+ 'expected ' => array (
520+ 'class ' => 'has-background ' ,
521+ 'style ' => 'background-size:cover; ' ,
522+ ),
523+ ),
481524 'numeric position is not output ' => array (
482525 'block_attributes ' => array (
483526 'style ' => array (
0 commit comments