Changeset 57716 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 02/27/2024 10:13:13 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r57662 r57716 5093 5093 } 5094 5094 5095 /** 5096 * Tests that the theme.json file is correctly parsed and the variables are resolved. 5097 * 5098 * @ticket 58588 5099 * @ticket 60613 5100 * 5101 * @covers WP_Theme_JSON_Gutenberg::resolve_variables 5102 * @covers WP_Theme_JSON_Gutenberg::convert_variables_to_value 5103 */ 5095 5104 public function test_resolve_variables() { 5096 5105 $primary_color = '#9DFF20'; … … 5100 5109 $large_font = '18px'; 5101 5110 $small_font = '12px'; 5111 $spacing = 'clamp(1.5rem, 5vw, 2rem)'; 5102 5112 $theme_json = new WP_Theme_JSON( 5103 5113 array( … … 5136 5146 'name' => 'Font size large', 5137 5147 'slug' => 'large', 5148 ), 5149 ), 5150 ), 5151 'spacing' => array( 5152 'spacingSizes' => array( 5153 array( 5154 'size' => $spacing, 5155 'name' => '100', 5156 'slug' => '100', 5138 5157 ), 5139 5158 ), … … 5201 5220 ), 5202 5221 ), 5222 'core/post-template' => array( 5223 'spacing' => array( 5224 'blockGap' => null, 5225 ), 5226 ), 5227 'core/columns' => array( 5228 'spacing' => array( 5229 'blockGap' => 'var(--wp--preset--spacing--100)', 5230 ), 5231 ), 5203 5232 ), 5204 5233 ), … … 5244 5273 $this->assertEquals( $small_font, $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Block variations: font-size' ); 5245 5274 $this->assertEquals( $secondary_color, $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Block variations: color' ); 5275 /* 5276 * As with wp_get_global_styles(), WP_Theme_JSON::resolve_variables may be called with merged data from 5277 * WP_Theme_JSON_Resolver. WP_Theme_JSON_Resolver::get_block_data() sets blockGap for supported blocks to `null` if the value is not defined. 5278 */ 5279 $this->assertNull( 5280 $styles['blocks']['core/post-template']['spacing']['blockGap'], 5281 'Blocks: Post Template spacing.blockGap should be null' 5282 ); 5283 $this->assertEquals( 5284 $spacing, 5285 $styles['blocks']['core/columns']['spacing']['blockGap'], 5286 'Blocks: Columns spacing.blockGap should match' 5287 ); 5246 5288 } 5247 5289
Note: See TracChangeset
for help on using the changeset viewer.