Changeset 64322
- Timestamp:
- 10/13/2026 05:49:42 AM (11 days ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/block-supports/states.php (modified) (2 diffs)
-
tests/phpunit/tests/block-supports/states.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/states.php
r64117 r64322 365 365 * 366 366 * @since 7.1.0 367 * @since 7.2.0 Added fallback dimension styles. 367 368 * 368 369 * @param array $css_rules Style rules. … … 376 377 return; 377 378 } 379 380 $style = wp_get_state_style_with_fallback_dimension_styles( $style ); 378 381 379 382 $compiled = wp_style_engine_get_styles( -
trunk/tests/phpunit/tests/block-supports/states.php
r64117 r64322 882 882 883 883 $this->assertSame( $expected, $actual ); 884 } 885 886 /** 887 * Tests that rendered state CSS includes fallback dimension declarations. 888 * 889 * @covers ::wp_render_block_states_support 890 * @covers ::wp_add_block_state_style_rule 891 * 892 * @ticket 66275 893 */ 894 public function test_responsive_height_generates_aspect_ratio_unset_in_stylesheet() { 895 $this->ensure_block_registered( 'test/responsive-root-state' ); 896 897 $block = array( 898 'blockName' => 'test/responsive-root-state', 899 'attrs' => array( 900 'style' => array( 901 '@mobile' => array( 902 'dimensions' => array( 'minHeight' => '300px' ), 903 ), 904 ), 905 ), 906 ); 907 908 $actual = wp_render_block_states_support( '<div class="wp-block-test">Hello</div>', $block ); 909 $processor = new WP_HTML_Tag_Processor( $actual ); 910 $this->assertTrue( $processor->next_tag() ); 911 912 $state_class = null; 913 foreach ( $processor->class_list() as $class_name ) { 914 if ( str_starts_with( $class_name, 'wp-states-' ) ) { 915 $state_class = $class_name; 916 break; 917 } 918 } 919 $this->assertIsString( $state_class, 'Expected a wp-states-* class on the first tag.' ); 920 921 $actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) ); 922 923 $this->assertStringContainsString( 924 "@media (width <= 480px){.{$state_class}{", 925 $actual_stylesheet 926 ); 927 $this->assertStringContainsString( 'min-height:300px', $actual_stylesheet ); 928 $this->assertStringContainsString( 'aspect-ratio:unset', $actual_stylesheet ); 884 929 } 885 930
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)