@@ -70,6 +70,7 @@ public function filter_set_theme_root() {
7070 * @ticket 61720
7171 * @ticket 61858
7272 * @ticket 64974
73+ * @ticket 66094
7374 *
7475 * @covers ::wp_render_background_support
7576 *
@@ -282,6 +283,108 @@ public function data_background_block_support() {
282283 'expected_wrapper ' => '<div>Content</div> ' ,
283284 'wrapper ' => '<div>Content</div> ' ,
284285 ),
286+ 'background clip alone does not add has-background ' => array (
287+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
288+ 'block_name ' => 'test/background-clip-is-output ' ,
289+ 'background_settings ' => array (
290+ 'backgroundClip ' => true ,
291+ ),
292+ 'background_style ' => array (
293+ 'backgroundClip ' => 'border-box ' ,
294+ ),
295+ 'expected_wrapper ' => '<div style="background-clip:border-box;-webkit-text-fill-color:currentColor;">Content</div> ' ,
296+ 'wrapper ' => '<div>Content</div> ' ,
297+ ),
298+ 'background clip text style is applied with vendor prefixes ' => array (
299+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
300+ 'block_name ' => 'test/background-clip-text-is-output ' ,
301+ 'background_settings ' => array (
302+ 'backgroundClip ' => true ,
303+ ),
304+ 'background_style ' => array (
305+ 'backgroundClip ' => 'text ' ,
306+ ),
307+ 'expected_wrapper ' => '<div style="background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;">Content</div> ' ,
308+ 'wrapper ' => '<div>Content</div> ' ,
309+ ),
310+ 'background clip alone does not add has-background for block with only backgroundClip support ' => array (
311+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
312+ 'block_name ' => 'test/background-clip-only-support ' ,
313+ 'background_settings ' => array (
314+ 'backgroundClip ' => true ,
315+ ),
316+ 'background_style ' => array (
317+ 'backgroundClip ' => 'padding-box ' ,
318+ ),
319+ 'expected_wrapper ' => '<p style="background-clip:padding-box;-webkit-text-fill-color:currentColor;">Content</p> ' ,
320+ 'wrapper ' => '<p>Content</p> ' ,
321+ ),
322+ 'background clip style is not applied if the block does not support it ' => array (
323+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
324+ 'block_name ' => 'test/background-clip-not-supported ' ,
325+ 'background_settings ' => array (
326+ 'backgroundClip ' => false ,
327+ ),
328+ 'background_style ' => array (
329+ 'backgroundClip ' => 'text ' ,
330+ ),
331+ 'expected_wrapper ' => '<div>Content</div> ' ,
332+ 'wrapper ' => '<div>Content</div> ' ,
333+ ),
334+ 'background clip keeps has-background when a background is painted into a box ' => array (
335+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
336+ 'block_name ' => 'test/background-clip-with-gradient ' ,
337+ 'background_settings ' => array (
338+ 'gradient ' => true ,
339+ 'backgroundClip ' => true ,
340+ ),
341+ 'background_style ' => array (
342+ 'gradient ' => 'linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%) ' ,
343+ 'backgroundClip ' => 'padding-box ' ,
344+ ),
345+ 'expected_wrapper ' => '<div class="has-background" style="background-image:linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%);background-clip:padding-box;-webkit-text-fill-color:currentColor;">Content</div> ' ,
346+ 'wrapper ' => '<div>Content</div> ' ,
347+ ),
348+ 'background clipped to text drops has-background from a gradient ' => array (
349+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
350+ 'block_name ' => 'test/background-clip-text-with-gradient ' ,
351+ 'background_settings ' => array (
352+ 'gradient ' => true ,
353+ 'backgroundClip ' => true ,
354+ ),
355+ 'background_style ' => array (
356+ 'gradient ' => 'linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%) ' ,
357+ 'backgroundClip ' => 'text ' ,
358+ ),
359+ 'expected_wrapper ' => '<div style="background-image:linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;">Content</div> ' ,
360+ 'wrapper ' => '<div>Content</div> ' ,
361+ ),
362+ 'background clipped to text keeps has-background when the block does not support the clip ' => array (
363+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
364+ 'block_name ' => 'test/background-clip-text-without-clip-support ' ,
365+ 'background_settings ' => array (
366+ 'gradient ' => true ,
367+ 'backgroundClip ' => false ,
368+ ),
369+ 'background_style ' => array (
370+ 'gradient ' => 'linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%) ' ,
371+ 'backgroundClip ' => 'text ' ,
372+ ),
373+ 'expected_wrapper ' => '<div class="has-background" style="background-image:linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,0,255) 100%);">Content</div> ' ,
374+ 'wrapper ' => '<div>Content</div> ' ,
375+ ),
376+ 'background clip style is appended to existing styles ' => array (
377+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
378+ 'block_name ' => 'test/background-clip-appends-styles ' ,
379+ 'background_settings ' => array (
380+ 'backgroundClip ' => true ,
381+ ),
382+ 'background_style ' => array (
383+ 'backgroundClip ' => 'content-box ' ,
384+ ),
385+ 'expected_wrapper ' => '<div class="wp-block-test" style="color: red;background-clip:content-box;-webkit-text-fill-color:currentColor;">Content</div> ' ,
386+ 'wrapper ' => '<div class="wp-block-test" style="color: red">Content</div> ' ,
387+ ),
285388 );
286389 }
287390
0 commit comments