-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for column and row spans in grid children. #6493
Changes from 4 commits
c9a0514
66a0692
ed8549d
0b97584
e0c0cba
81a54f5
0926acf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -181,6 +181,7 @@ public function test_outer_container_not_restored_for_aligned_image_block_with_t | |||||
* @param string $expected_output The expected output. | ||||||
*/ | ||||||
public function test_layout_support_flag_renders_classnames_on_wrapper( $args, $expected_output ) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I notice this function includes references to the tickets directly above it. Should the linked trac ticket be added to that list? |
||||||
switch_theme( 'default' ); | ||||||
$actual_output = wp_render_layout_support_flag( $args['block_content'], $args['block'] ); | ||||||
$this->assertSame( $expected_output, $actual_output ); | ||||||
} | ||||||
|
@@ -251,6 +252,27 @@ public function data_layout_support_flag_renders_classnames_on_wrapper() { | |||||
), | ||||||
'expected_output' => '<div class="wp-block-group"><div class="wp-block-group__inner-wrapper is-layout-flow wp-block-group-is-layout-flow"></div></div>', | ||||||
), | ||||||
'block with child layout' => array( | ||||||
'args' => array( | ||||||
'block_content' => '<p>Some text.</p>', | ||||||
'block' => array( | ||||||
'blockName' => 'core/paragraph', | ||||||
'attrs' => array( | ||||||
'style' => array( | ||||||
'layout' => array( | ||||||
'columnSpan' => '2', | ||||||
), | ||||||
), | ||||||
), | ||||||
'innerBlocks' => array(), | ||||||
'innerHTML' => '<p>Some text.</p>', | ||||||
'innerContent' => array( | ||||||
'<p>Some text.</p>', | ||||||
), | ||||||
), | ||||||
), | ||||||
'expected_output' => '<p class="wp-container-content-1">Some text.</p>', // The generated classname number assumes `wp_unique_id` will not have run previously in this test. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny nit: the code now uses
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably worth including the prefix in Andrew's comment too, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks! |
||||||
), | ||||||
'skip classname output if block does not support layout and there are no child layout classes to be output' => array( | ||||||
'args' => array( | ||||||
'block_content' => '<p>A paragraph</p>', | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double-checked the WP coding standards, and it looks like it's discouraged to use anonymous functions in filters:
Should we move this to a named function so that plugins (if they really wanted to) are able to
remove_filter
this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!