Changeset 55176 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 02/01/2023 06:05:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r55175 r55176 4435 4435 $this->assertSame( $expected, $theme_json->get_stylesheet() ); 4436 4436 } 4437 4438 /** 4439 * @ticket 57559 4440 */ 4441 public function test_shadow_preset_styles() { 4442 $theme_json = new WP_Theme_JSON( 4443 array( 4444 'version' => WP_Theme_JSON::LATEST_SCHEMA, 4445 'settings' => array( 4446 'shadow' => array( 4447 'presets' => array( 4448 array( 4449 'slug' => 'natural', 4450 'shadow' => '5px 5px 5px 0 black', 4451 ), 4452 array( 4453 'slug' => 'sharp', 4454 'shadow' => '5px 5px black', 4455 ), 4456 ), 4457 ), 4458 ), 4459 ) 4460 ); 4461 4462 $expected_styles = 'body{--wp--preset--shadow--natural: 5px 5px 5px 0 black;--wp--preset--shadow--sharp: 5px 5px black;}'; 4463 $this->assertSame( $expected_styles, $theme_json->get_stylesheet(), 'Styles returned from "::get_stylesheet()" does not match expectations' ); 4464 $this->assertSame( $expected_styles, $theme_json->get_stylesheet( array( 'variables' ) ), 'Styles returned from "::get_stylesheet()" when requiring "variables" type does not match expectations' ); 4465 } 4466 4467 /** 4468 * @ticket 57559 4469 */ 4470 public function test_get_shadow_styles_for_blocks() { 4471 $theme_json = new WP_Theme_JSON( 4472 array( 4473 'version' => WP_Theme_JSON::LATEST_SCHEMA, 4474 'settings' => array( 4475 'shadow' => array( 4476 'presets' => array( 4477 array( 4478 'slug' => 'natural', 4479 'shadow' => '5px 5px 0 0 black', 4480 ), 4481 ), 4482 ), 4483 ), 4484 'styles' => array( 4485 'blocks' => array( 4486 'core/paragraph' => array( 4487 'shadow' => 'var(--wp--preset--shadow--natural)', 4488 ), 4489 ), 4490 'elements' => array( 4491 'button' => array( 4492 'shadow' => 'var:preset|shadow|natural', 4493 ), 4494 'link' => array( 4495 'shadow' => array( 'ref' => 'styles.elements.button.shadow' ), 4496 ), 4497 ), 4498 ), 4499 ) 4500 ); 4501 4502 $global_styles = 'body{--wp--preset--shadow--natural: 5px 5px 0 0 black;}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; }'; 4503 $element_styles = 'a:where(:not(.wp-element-button)){box-shadow: var(--wp--preset--shadow--natural);}.wp-element-button, .wp-block-button__link{box-shadow: var(--wp--preset--shadow--natural);}p{box-shadow: var(--wp--preset--shadow--natural);}'; 4504 $expected_styles = $global_styles . $element_styles; 4505 4506 $this->assertSame( $expected_styles, $theme_json->get_stylesheet() ); 4507 } 4437 4508 }
Note: See TracChangeset
for help on using the changeset viewer.