Skip to content

Commit bf1d22c

Browse files
committed
Update block visibility tests to disable CSS prettification in stylesheet retrieval. This change ensures that the generated styles for mobile, tablet, and desktop breakpoints are returned without additional formatting, allowing for accurate assertions in the tests.
1 parent d29d93c commit bf1d22c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/phpunit/tests/block-supports/block-visibility.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function test_block_visibility_support_generated_css_with_mobile_breakpoi
153153

154154
$this->assertStringContainsString( 'wp-block-hidden-mobile', $result, 'Block should have the visibility class for the mobile breakpoint.' );
155155

156-
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports' );
156+
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) );
157157

158158
$this->assertSame(
159159
'@media (max-width: 599px){.wp-block-hidden-mobile{display:none !important;}}',
@@ -187,7 +187,7 @@ public function test_block_visibility_support_generated_css_with_tablet_breakpoi
187187

188188
$this->assertStringContainsString( 'class="existing-class wp-block-hidden-tablet"', $result, 'Block should have the existing class and the visibility class for the tablet breakpoint in the class attribute.' );
189189

190-
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports' );
190+
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) );
191191

192192
$this->assertSame(
193193
'@media (min-width: calc(599px + 1px)) and (max-width: 959px){.wp-block-hidden-tablet{display:none !important;}}',
@@ -221,7 +221,7 @@ public function test_block_visibility_support_generated_css_with_desktop_breakpo
221221

222222
$this->assertStringContainsString( 'class="wp-block-hidden-desktop"', $result, 'Block should have the visibility class for the desktop breakpoint in the class attribute.' );
223223

224-
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports' );
224+
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) );
225225

226226
$this->assertSame(
227227
'@media (min-width: calc(959px + 1px)){.wp-block-hidden-desktop{display:none !important;}}',
@@ -260,7 +260,7 @@ public function test_block_visibility_support_generated_css_with_multiple_breakp
260260
'Block should have both visibility classes in the class attribute'
261261
);
262262

263-
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports' );
263+
$actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) );
264264

265265
$this->assertSame(
266266
'@media (min-width: calc(959px + 1px)){.wp-block-hidden-desktop{display:none !important;}}@media (max-width: 599px){.wp-block-hidden-mobile{display:none !important;}}',

0 commit comments

Comments
 (0)