Skip to content

Commit

Permalink
Make WP_Theme_JSON_Resolver tests pure (#36253)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal authored Nov 5, 2021
1 parent 51a0a21 commit 46ead8c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1674,43 +1674,40 @@ function test_get_editor_settings_blank() {

function test_get_editor_settings_custom_units_can_be_disabled() {
add_theme_support( 'custom-units', array() );
$input = gutenberg_get_default_block_editor_settings();
$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( gutenberg_get_default_block_editor_settings() );
remove_theme_support( 'custom-units' );

$expected = array(
'units' => array( array() ),
'padding' => false,
);

$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( $input );

$this->assertEqualSetsWithIndex( $expected, $actual['settings']['spacing'] );
}

function test_get_editor_settings_custom_units_can_be_enabled() {
add_theme_support( 'custom-units' );
$input = gutenberg_get_default_block_editor_settings();
$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( gutenberg_get_default_block_editor_settings() );
remove_theme_support( 'custom-units' );

$expected = array(
'units' => array( 'px', 'em', 'rem', 'vh', 'vw', '%' ),
'padding' => false,
);

$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( $input );

$this->assertEqualSetsWithIndex( $expected, $actual['settings']['spacing'] );
}

function test_get_editor_settings_custom_units_can_be_filtered() {
add_theme_support( 'custom-units', 'rem', 'em' );
$input = gutenberg_get_default_block_editor_settings();
$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( gutenberg_get_default_block_editor_settings() );
remove_theme_support( 'custom-units' );

$expected = array(
'units' => array( 'rem', 'em' ),
'padding' => false,
);

$actual = WP_Theme_JSON_Gutenberg::get_from_editor_settings( $input );

$this->assertEqualSetsWithIndex( $expected, $actual['settings']['spacing'] );
}

Expand Down

0 comments on commit 46ead8c

Please sign in to comment.