From ef450b69ee5d0ddf33765ad5b206dd897a11f8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 13 Dec 2022 15:38:45 +0100 Subject: [PATCH] Add test_switching_themes_recalculates_stylesheet --- tests/phpunit/tests/theme/wpGetGlobalStylesheet.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php b/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php index 710f77d0caf0d..651749bb20ca5 100644 --- a/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php +++ b/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php @@ -270,4 +270,12 @@ public function test_should_enqueue_stored_styles() { 'Registered styles with handle of "wp-style-engine-my-styles" do not match expected value from the Style Engine store.' ); } + + public function test_switching_themes_recalculates_stylesheet() { + $stylesheet_for_default_theme = wp_get_global_stylesheet(); + switch_theme( 'block-theme' ); + $stylesheet_for_block_theme = wp_get_global_stylesheet(); + $this->assertStringNotContainsString( '--wp--preset--font-size--custom: 100px;', $stylesheet_for_default_theme, 'custom font size (100px) not present for default theme' ); + $this->assertStringContainsString( '--wp--preset--font-size--custom: 100px;', $stylesheet_for_block_theme, 'custom font size (100px) is present for block theme' ); + } }