@@ -1149,6 +1149,45 @@ public function testRenderElementDoNotDisplay($displayValue): void
11491149 $ this ->assertEquals ($ blockHtml , $ this ->model ->renderElement ($ name , false ));
11501150 }
11511151
1152+ /**
1153+ * @param string $expectedResult
1154+ * @param string $blockHtml
1155+ *
1156+ * @return void
1157+ * @dataProvider trimWhitespaceContainingBlockHtmlDataProvider
1158+ */
1159+ public function testTrimWhitespaceContainingBlockHtml ($ expectedResult , $ blockHtml ): void
1160+ {
1161+ $ name = 'test_container ' ;
1162+ $ child = 'child_block ' ;
1163+ $ children = [$ child => true ];
1164+ $ displayValue = true ;
1165+
1166+ $ this ->structureMock ->expects ($ this ->atLeastOnce ())
1167+ ->method ('getAttribute ' )
1168+ ->willReturnMap (
1169+ [
1170+ [$ name , 'display ' , $ displayValue ],
1171+ [$ child , 'display ' , $ displayValue ],
1172+ [$ child , 'type ' , Element::TYPE_BLOCK ]
1173+ ]
1174+ );
1175+
1176+ $ this ->structureMock ->expects ($ this ->atLeastOnce ())->method ('hasElement ' )
1177+ ->willReturnMap ([[$ child , true ]]);
1178+
1179+ $ this ->structureMock ->expects ($ this ->once ())
1180+ ->method ('getChildren ' )
1181+ ->with ($ name )
1182+ ->willReturn ($ children );
1183+
1184+ $ block = $ this ->createMock (AbstractBlock::class);
1185+ $ block ->expects ($ this ->once ())->method ('toHtml ' )->willReturn ($ blockHtml );
1186+
1187+ $ this ->model ->setBlock ($ child , $ block );
1188+ $ this ->assertEquals ($ expectedResult , $ this ->model ->renderElement ($ name , false ));
1189+ }
1190+
11521191 /**
11531192 * @return array
11541193 */
@@ -1161,6 +1200,17 @@ public static function renderElementDoNotDisplayDataProvider(): array
11611200 ];
11621201 }
11631202
1203+ /**
1204+ * @return array
1205+ */
1206+ public static function trimWhitespaceContainingBlockHtmlDataProvider (): array
1207+ {
1208+ return [
1209+ ['' , ' ' ],
1210+ [' <html/> ' , ' <html/> ' ]
1211+ ];
1212+ }
1213+
11641214 /**
11651215 * @return array
11661216 */
0 commit comments