Skip to content

Commit

Permalink
Added test to check resolution of spacing presets
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Feb 22, 2024
1 parent 48d279d commit ece1a4d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4969,6 +4969,7 @@ public function test_resolve_variables() {
$raw_color_value = '#efefef';
$large_font = '18px';
$small_font = '12px';
$spacing = 'clamp(1.5rem, 5vw, 2rem)';
$theme_json = new WP_Theme_JSON_Gutenberg(
array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
Expand Down Expand Up @@ -5008,6 +5009,15 @@ public function test_resolve_variables() {
),
),
),
'spacing' => array(
'spacingSizes' => array(
array(
'size' => $spacing,
'name' => '100',
'slug' => '100',
),
),
),
),
'styles' => array(
'color' => array(
Expand Down Expand Up @@ -5077,7 +5087,7 @@ public function test_resolve_variables() {
),
'core/columns' => array(
'spacing' => array(
'margin' => 'var(--wp--preset--spacing--100)',
'blockGap' => 'var(--wp--preset--spacing--100)',
),
),
),
Expand Down Expand Up @@ -5128,6 +5138,7 @@ public function test_resolve_variables() {
* WP_Theme_JSON_Resolver_Gutenberg::get_block_data() sets blockGap for supported blocks to `null` if the value is not defined.
*/
$this->assertNull( $styles['blocks']['core/post-template']['spacing']['blockGap'], 'core/post-template block: blockGap' );
$this->assertEquals( $spacing, $styles['blocks']['core/columns']['spacing']['blockGap'], 'core/columns block: blockGap' );
}

/**
Expand Down

0 comments on commit ece1a4d

Please sign in to comment.