Changeset 54821 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 11/11/2022 05:09:11 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r54804 r54821 3999 3999 ); 4000 4000 } 4001 4002 /** 4003 * Tests the core separator block outbut based on various provided settings. 4004 * 4005 * @ticket 56903 4006 * 4007 * @dataProvider data_update_separator_declarations 4008 * 4009 * @param array $separator_block_settings Example separator block settings from the data provider. 4010 * @param array $expected_output Expected output from data provider. 4011 */ 4012 public function test_update_separator_declarations( $separator_block_settings, $expected_output ) { 4013 // If only background is defined, test that includes border-color to the style so it is applied on the front end. 4014 $theme_json = new WP_Theme_JSON( 4015 array( 4016 'version' => WP_Theme_JSON::LATEST_SCHEMA, 4017 'styles' => array( 4018 'blocks' => array( 4019 'core/separator' => $separator_block_settings, 4020 ), 4021 ), 4022 ), 4023 'default' 4024 ); 4025 4026 $stylesheet = $theme_json->get_stylesheet( array( 'styles' ) ); 4027 4028 $this->assertSame( $expected_output, $stylesheet ); 4029 } 4030 4031 /** 4032 * Data provider for separator declaration tests. 4033 * 4034 * @return array 4035 */ 4036 function data_update_separator_declarations() { 4037 return array( 4038 // If only background is defined, test that includes border-color to the style so it is applied on the front end. 4039 'only background' => array( 4040 array( 4041 'color' => array( 4042 'background' => 'blue', 4043 ), 4044 ), 4045 'expected_output' => '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; }.wp-block-separator{background-color: blue;color: blue;}', 4046 ), 4047 // If background and text are defined, do not include border-color, as text color is enough. 4048 'background and text, no border-color' => array( 4049 array( 4050 'color' => array( 4051 'background' => 'blue', 4052 'text' => 'red', 4053 ), 4054 ), 4055 'expected_output' => '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; }.wp-block-separator{background-color: blue;color: red;}', 4056 ), 4057 // If only text is defined, do not include border-color, as by itself is enough. 4058 'only text' => array( 4059 array( 4060 'color' => array( 4061 'text' => 'red', 4062 ), 4063 ), 4064 'expected_output' => '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; }.wp-block-separator{color: red;}', 4065 ), 4066 // If background, text, and border-color are defined, include everything, CSS specifity will decide which to apply. 4067 'background, text, and border-color' => array( 4068 array( 4069 'color' => array( 4070 'background' => 'blue', 4071 'text' => 'red', 4072 ), 4073 'border' => array( 4074 'color' => 'pink', 4075 ), 4076 ), 4077 'expected_output' => '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; }.wp-block-separator{background-color: blue;border-color: pink;color: red;}', 4078 ), 4079 // If background and border color are defined, include everything, CSS specifity will decide which to apply. 4080 'background, text, and border-color' => array( 4081 array( 4082 'color' => array( 4083 'background' => 'blue', 4084 ), 4085 'border' => array( 4086 'color' => 'pink', 4087 ), 4088 ), 4089 'expected_output' => '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; }.wp-block-separator{background-color: blue;border-color: pink;}', 4090 ), 4091 ); 4092 } 4001 4093 }
Note: See TracChangeset
for help on using the changeset viewer.