File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -564,6 +564,33 @@ public function data_layout_support_flag_renders_classnames_on_wrapper() {
564564 ),
565565 'expected_output ' => '<div class="wp-block-group is-layout-grid wp-container-core-group-is-layout-9d260ee2 wp-block-group-is-layout-grid"></div> ' ,
566566 ),
567+ /*
568+ * When the first innerContent chunk contains a sibling element (one that fully opens
569+ * and closes before the inner blocks), the layout classes must be added to the outer
570+ * container — not to the sibling. The sibling's class was incorrectly chosen by the
571+ * previous logic because it was the last class encountered while scanning the chunk.
572+ */
573+ 'outer wrapper targeted when sibling element precedes inner blocks ' => array (
574+ 'args ' => array (
575+ 'block_content ' => '<div class="wp-block-group"><div class="wp-block-group__header">Header</div><p>Inner block</p></div> ' ,
576+ 'block ' => array (
577+ 'blockName ' => 'core/group ' ,
578+ 'attrs ' => array (
579+ 'layout ' => array (
580+ 'type ' => 'default ' ,
581+ ),
582+ ),
583+ 'innerBlocks ' => array (),
584+ 'innerHTML ' => '<div class="wp-block-group"><div class="wp-block-group__header">Header</div><p>Inner block</p></div> ' ,
585+ 'innerContent ' => array (
586+ '<div class="wp-block-group"><div class="wp-block-group__header">Header</div> ' ,
587+ null ,
588+ '</div> ' ,
589+ ),
590+ ),
591+ ),
592+ 'expected_output ' => '<div class="wp-block-group is-layout-flow wp-block-group-is-layout-flow"><div class="wp-block-group__header">Header</div><p>Inner block</p></div> ' ,
593+ ),
567594 );
568595 }
569596
You can’t perform that action at this time.
0 commit comments