Hello
'; + $block = array( + 'blockName' => 'core/paragraph', + 'attrs' => array( + 'style' => array( + 'typography' => array( + 'textAlign' => 'left', + ), + '@mobile' => array( + 'typography' => array( + 'textAlign' => 'right', + ), + ), + ), + ), + ); + + $actual = gutenberg_render_block_states_support( $block_content, $block ); + + $this->assertMatchesRegularExpression( + '/^Hello<\/p>$/', + $actual + ); + preg_match( '/wp-states-[a-f0-9]{8}/', $actual, $matches ); + $actual_stylesheet = gutenberg_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) ); + + $this->assertStringContainsString( + '@media (width <= 480px){.' . $matches[0] . '{text-align:right !important;}}', + $actual_stylesheet + ); + } + public function test_legacy_responsive_root_state_generates_media_query_scoped_css() { $this->ensure_block_registered( 'core/paragraph' );