@@ -67,6 +67,7 @@ public function filter_set_theme_root() {
6767 * Tests that background image block support works as expected.
6868 *
6969 * @ticket 59357
70+ * @ticket 60175
7071 *
7172 * @covers ::wp_render_background_support
7273 *
@@ -135,7 +136,24 @@ public function data_background_block_support() {
135136 'source ' => 'file ' ,
136137 ),
137138 ),
138- 'expected_wrapper ' => '<div style="background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
139+ 'expected_wrapper ' => '<div class="has-background" style="background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
140+ 'wrapper ' => '<div>Content</div> ' ,
141+ ),
142+ 'background image style with contain, position, and repeat is applied ' => array (
143+ 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
144+ 'block_name ' => 'test/background-rules-are-output ' ,
145+ 'background_settings ' => array (
146+ 'backgroundImage ' => true ,
147+ ),
148+ 'background_style ' => array (
149+ 'backgroundImage ' => array (
150+ 'url ' => 'https://example.com/image.jpg ' ,
151+ 'source ' => 'file ' ,
152+ ),
153+ 'backgroundRepeat ' => 'no-repeat ' ,
154+ 'backgroundSize ' => 'contain ' ,
155+ ),
156+ 'expected_wrapper ' => '<div class="has-background" style="background-image:url('https://example.com/image.jpg');background-position:center;background-repeat:no-repeat;background-size:contain;">Content</div> ' ,
139157 'wrapper ' => '<div>Content</div> ' ,
140158 ),
141159 'background image style is appended if a style attribute already exists ' => array (
@@ -150,8 +168,8 @@ public function data_background_block_support() {
150168 'source ' => 'file ' ,
151169 ),
152170 ),
153- 'expected_wrapper ' => '<div classname ="wp-block-test" style="color: red;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
154- 'wrapper ' => '<div classname ="wp-block-test" style="color: red">Content</div> ' ,
171+ 'expected_wrapper ' => '<div class ="wp-block-test has-background " style="color: red;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
172+ 'wrapper ' => '<div class ="wp-block-test" style="color: red">Content</div> ' ,
155173 ),
156174 'background image style is appended if a style attribute containing multiple styles already exists ' => array (
157175 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
@@ -165,8 +183,8 @@ public function data_background_block_support() {
165183 'source ' => 'file ' ,
166184 ),
167185 ),
168- 'expected_wrapper ' => '<div classname ="wp-block-test" style="color: red;font-size: 15px;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
169- 'wrapper ' => '<div classname ="wp-block-test" style="color: red;font-size: 15px;">Content</div> ' ,
186+ 'expected_wrapper ' => '<div class ="wp-block-test has-background " style="color: red;font-size: 15px;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div> ' ,
187+ 'wrapper ' => '<div class ="wp-block-test" style="color: red;font-size: 15px;">Content</div> ' ,
170188 ),
171189 'background image style is not applied if the block does not support background image ' => array (
172190 'theme_name ' => 'block-theme-child-with-fluid-typography ' ,
0 commit comments