- Timestamp:
- 07/09/2024 10:22:10 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-supports/block-style-variations.php
r58466 r58691 160 160 $this->assertSameSetsWithIndex( $expected, $group_styles, 'Variation data does not match' ); 161 161 } 162 163 /** 164 * Tests that block style variations resolve any `ref` values when generating styles. 165 * 166 * @ticket 61589 167 */ 168 public function test_block_style_variation_ref_values() { 169 switch_theme( 'block-theme' ); 170 171 $variation_data = array( 172 'color' => array( 173 'text' => array( 174 'ref' => 'styles.does-not-exist', 175 ), 176 'background' => array( 177 'ref' => 'styles.blocks.core/group.variations.block-style-variation-a.color.text', 178 ), 179 ), 180 'blocks' => array( 181 'core/heading' => array( 182 'color' => array( 183 'text' => array( 184 'ref' => 'styles.blocks.core/group.variations.block-style-variation-a.color.background', 185 ), 186 'background' => array( 187 'ref' => '', 188 ), 189 ), 190 ), 191 ), 192 'elements' => array( 193 'link' => array( 194 'color' => array( 195 'text' => array( 196 'ref' => 'styles.blocks.core/group.variations.block-style-variation-b.color.text', 197 ), 198 'background' => array( 199 'ref' => null, 200 ), 201 ), 202 ':hover' => array( 203 'color' => array( 204 'text' => array( 205 'ref' => 'styles.blocks.core/group.variations.block-style-variation-b.color.background', 206 ), 207 ), 208 ), 209 ), 210 ), 211 ); 212 213 $theme_json = WP_Theme_JSON_Resolver::get_theme_data()->get_raw_data(); 214 215 wp_resolve_block_style_variation_ref_values( $variation_data, $theme_json ); 216 217 $expected = array( 218 'color' => array( 'background' => 'plum' ), 219 'blocks' => array( 220 'core/heading' => array( 221 'color' => array( 'text' => 'indigo' ), 222 ), 223 ), 224 'elements' => array( 225 'link' => array( 226 'color' => array( 'text' => 'lightblue' ), 227 ':hover' => array( 228 'color' => array( 'text' => 'midnightblue' ), 229 ), 230 ), 231 ), 232 ); 233 234 $this->assertSameSetsWithIndex( $expected, $variation_data, 'Variation data with resolved ref values does not match' ); 235 } 162 236 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)