Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure tests are pure #36253

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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