Skip to content

Commit

Permalink
Test that add_theme_supports are loaded for themes without `theme.j…
Browse files Browse the repository at this point in the history
…son` (#34998)

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
  • Loading branch information
oandregal and Mamaduka authored Sep 21, 2021
1 parent 78470d4 commit a2169df
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions phpunit/class-wp-theme-json-resolver-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,33 @@ function test_switching_themes_recalculates_data() {
$this->assertSame( true, $fse );
}

function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
switch_theme( 'default' );
add_theme_support( 'custom-line-height' );
$color_palette = array(
array(
'name' => 'Primary',
'slug' => 'primary',
'color' => '#F00',
),
array(
'name' => 'Secondary',
'slug' => 'secondary',
'color' => '#0F0',
),
array(
'name' => 'Tertiary',
'slug' => 'tertiary',
'color' => '#00F',
),
);
add_theme_support( 'editor-color-palette', $color_palette );
$supports = gutenberg_get_default_block_editor_settings();
$settings = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( $supports )->get_settings();

$this->assertSame( false, WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() );
$this->assertSame( true, $settings['typography']['customLineHeight'] );
$this->assertSame( $color_palette, $settings['color']['palette']['theme'] );
}

}

0 comments on commit a2169df

Please sign in to comment.