Changeset 57352
- Timestamp:
- 01/25/2024 10:41:38 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r57340 r57352 936 936 if ( $duotone_support ) { 937 937 $root_selector = wp_get_block_css_selector( $block_type ); 938 $duotone_selector = WP_Theme_JSON::scope_selector( $root_selector, $duotone_support );938 $duotone_selector = static::scope_selector( $root_selector, $duotone_support ); 939 939 } 940 940 } … … 1079 1079 } 1080 1080 if ( false !== $root_style_key ) { 1081 $s etting_nodes[ $root_style_key ]['selector'] = $options['root_selector'];1081 $style_nodes[ $root_style_key ]['selector'] = $options['root_selector']; 1082 1082 } 1083 1083 } -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r57333 r57352 3211 3211 * @param array $styles An array with style definitions. 3212 3212 * @param array $path Path to the desired properties. 3213 *3214 3213 */ 3215 3214 public function test_get_property_value_should_return_string_for_invalid_paths_or_null_values( $styles, $path ) { … … 4940 4939 $this->assertEquals( $secondary_color, $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Block variations: color' ); 4941 4940 } 4941 4942 /** 4943 * Tests that a custom root selector is correctly applied when generating a stylesheet. 4944 * 4945 * @ticket 60343 4946 */ 4947 public function test_get_stylesheet_custom_root_selector() { 4948 $theme_json = new WP_Theme_JSON( 4949 array( 4950 'version' => WP_Theme_JSON::LATEST_SCHEMA, 4951 'styles' => array( 4952 'color' => array( 4953 'text' => 'teal', 4954 ), 4955 ), 4956 ), 4957 'default' 4958 ); 4959 4960 $options = array( 'root_selector' => '.custom' ); 4961 $actual = $theme_json->get_stylesheet( array( 'styles' ), null, $options ); 4962 4963 // Results also include root site blocks styles which hard code 4964 // `body { margin: 0;}`. 4965 $this->assertEquals( 4966 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.custom{color: teal;}', 4967 $actual 4968 ); 4969 } 4942 4970 }
Note: See TracChangeset
for help on using the changeset viewer.