@@ -1149,6 +1149,45 @@ public function testRenderElementDoNotDisplay($displayValue): void
1149
1149
$ this ->assertEquals ($ blockHtml , $ this ->model ->renderElement ($ name , false ));
1150
1150
}
1151
1151
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
+
1152
1191
/**
1153
1192
* @return array
1154
1193
*/
@@ -1161,6 +1200,17 @@ public static function renderElementDoNotDisplayDataProvider(): array
1161
1200
];
1162
1201
}
1163
1202
1203
+ /**
1204
+ * @return array
1205
+ */
1206
+ public static function trimWhitespaceContainingBlockHtmlDataProvider (): array
1207
+ {
1208
+ return [
1209
+ ['' , ' ' ],
1210
+ [' <html/> ' , ' <html/> ' ]
1211
+ ];
1212
+ }
1213
+
1164
1214
/**
1165
1215
* @return array
1166
1216
*/
0 commit comments