Changeset 58703 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 07/10/2024 06:17:44 AM (19 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r58685 r58703 5036 5036 5037 5037 /** 5038 * @ticket 57536 5039 * @ticket 61165 5040 */ 5041 public function test_get_custom_css_handles_global_custom_css() { 5038 * Tests that base custom CSS is generated correctly. 5039 * 5040 * @ticket 61395 5041 */ 5042 public function test_get_stylesheet_handles_base_custom_css() { 5042 5043 $theme_json = new WP_Theme_JSON( 5043 5044 array( 5044 5045 'version' => WP_Theme_JSON::LATEST_SCHEMA, 5045 5046 'styles' => array( 5046 'css' => 'body {color:purple;}', 5047 'css' => 'body {color:purple;}', 5048 ), 5049 ) 5050 ); 5051 5052 $custom_css = 'body {color:purple;}'; 5053 $this->assertSame( $custom_css, $theme_json->get_stylesheet( array( 'custom-css' ) ) ); 5054 } 5055 5056 /** 5057 * Tests that block custom CSS is generated correctly. 5058 * 5059 * @ticket 61395 5060 */ 5061 public function test_get_styles_for_block_handles_block_custom_css() { 5062 $theme_json = new WP_Theme_JSON( 5063 array( 5064 'version' => WP_Theme_JSON::LATEST_SCHEMA, 5065 'styles' => array( 5047 5066 'blocks' => array( 5048 5067 'core/paragraph' => array( … … 5054 5073 ); 5055 5074 5056 $custom_css = 'body {color:purple;}:root :where(p){color:red;}'; 5057 $this->assertSame( $custom_css, $theme_json->get_custom_css() ); 5075 $paragraph_node = array( 5076 'name' => 'core/paragraph', 5077 'path' => array( 'styles', 'blocks', 'core/paragraph' ), 5078 'selector' => 'p', 5079 'selectors' => array( 5080 'root' => 'p', 5081 ), 5082 ); 5083 5084 $custom_css = ':root :where(p){color:red;}'; 5085 $this->assertSame( $custom_css, $theme_json->get_styles_for_block( $paragraph_node ) ); 5058 5086 } 5059 5087
Note: See TracChangeset
for help on using the changeset viewer.