Changeset 60727
- Timestamp:
- 09/10/2025 08:25:46 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
- src/wp-includes/block-supports/background.php (modified) (1 diff)
- tests/phpunit/tests/block-supports/layout.php (modified) (1 diff)
- tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/background.php
r58936 r60727 88 88 if ( $tags->next_tag() ) { 89 89 $existing_style = $tags->get_attribute( 'style' ); 90 $updated_style = ''; 91 92 if ( ! empty( $existing_style ) ) { 93 $updated_style = $existing_style; 94 if ( ! str_ends_with( $existing_style, ';' ) ) { 95 $updated_style .= ';'; 96 } 90 if ( is_string( $existing_style ) && '' !== $existing_style ) { 91 $separator = str_ends_with( $existing_style, ';' ) ? '' : ';'; 92 $updated_style = "{$existing_style}{$separator}{$styles['css']}"; 93 } else { 94 $updated_style = $styles['css']; 97 95 } 98 96 99 $updated_style .= $styles['css'];100 97 $tags->set_attribute( 'style', $updated_style ); 101 98 $tags->add_class( 'has-background' ); -
trunk/tests/phpunit/tests/block-supports/layout.php
r60038 r60727 185 185 switch_theme( 'default' ); 186 186 $actual_output = wp_render_layout_support_flag( $args['block_content'], $args['block'] ); 187 $this->assert Same( $expected_output, $actual_output );187 $this->assertEqualHTML( $expected_output, $actual_output ); 188 188 } 189 189 -
trunk/tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php
r58936 r60727 187 187 'wrapper' => '<div class="wp-block-test" style="color: red;font-size: 15px;">Content</div>', 188 188 ), 189 'background image style is appended if a boolean style attribute already exists' => array( 190 'theme_name' => 'block-theme-child-with-fluid-typography', 191 'block_name' => 'test/background-rules-are-output', 192 'background_settings' => array( 193 'backgroundImage' => true, 194 ), 195 'background_style' => array( 196 'backgroundImage' => array( 197 'url' => 'https://example.com/image.jpg', 198 'source' => 'file', 199 ), 200 ), 201 'expected_wrapper' => '<div class="has-background" classname="wp-block-test" style="background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>', 202 'wrapper' => '<div classname="wp-block-test" style>Content</div>', 203 ), 189 204 'background image style is not applied if the block does not support background image' => array( 190 205 'theme_name' => 'block-theme-child-with-fluid-typography',
Note: See TracChangeset for help on using the changeset viewer.