Skip to content

Commit 320cd0f

Browse files
committed
This commit introduces a new test to verify that block content is empty when all visibility breakpoints (mobile, tablet, desktop) are set to false.
1 parent ea13827 commit 320cd0f

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,34 @@ public function test_block_visibility_support_generated_css_with_all_breakpoints
236236
$this->assertSame( $block_content, $result, 'Block content should remain unchanged when all breakpoints are visible.' );
237237
}
238238

239+
/*
240+
* @ticket 64414
241+
*/
242+
public function test_block_visibility_support_generated_css_with_all_breakpoints_hidden() {
243+
$this->register_visibility_block_with_support(
244+
'test/viewport-all-hidden',
245+
array( 'visibility' => true )
246+
);
247+
248+
$block = array(
249+
'blockName' => 'test/viewport-all-hidden',
250+
'attrs' => array(
251+
'metadata' => array(
252+
'blockVisibility' => array(
253+
'mobile' => false,
254+
'tablet' => false,
255+
'desktop' => false,
256+
),
257+
),
258+
),
259+
);
260+
261+
$block_content = '<div>Test content</div>';
262+
$result = wp_render_block_visibility_support( $block_content, $block );
263+
264+
$this->assertSame( '', $result, 'Block content should be empty when all breakpoints are hidden.' );
265+
}
266+
239267
/*
240268
* @ticket 64414
241269
*/
@@ -257,7 +285,7 @@ public function test_block_visibility_support_generated_css_with_empty_object()
257285
$block_content = '<div>Test content</div>';
258286
$result = wp_render_block_visibility_support( $block_content, $block );
259287

260-
$this->assertSame( $block_content, $result, 'Block content should remain unchanged when there is no visibility object.' );
288+
$this->assertSame( $block_content, $result, 'Block content should remain unchanged when blockVisibility is an empty array.' );
261289
}
262290

263291
/*

0 commit comments

Comments
 (0)