@@ -197,6 +197,89 @@ public function testHelpAttr()
197197 );
198198 }
199199
200+ public function testHelpHtmlDefaultIsFalse ()
201+ {
202+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
203+ 'help ' => 'Help <b>text</b> test! ' ,
204+ ]);
205+
206+ $ view = $ form ->createView ();
207+ $ html = $ this ->renderHelp ($ view );
208+
209+ $ this ->assertMatchesXpath ($ html ,
210+ '/small
211+ [@id="name_help"]
212+ [@class="form-text text-muted"]
213+ [.="[trans]Help <b>text</b> test![/trans]"]
214+ '
215+ );
216+
217+ $ this ->assertMatchesXpath ($ html ,
218+ '/small
219+ [@id="name_help"]
220+ [@class="form-text text-muted"]
221+ /b
222+ [.="text"]
223+ ' , 0
224+ );
225+ }
226+
227+ public function testHelpHtmlIsFalse ()
228+ {
229+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
230+ 'help ' => 'Help <b>text</b> test! ' ,
231+ 'help_html ' => false ,
232+ ]);
233+
234+ $ view = $ form ->createView ();
235+ $ html = $ this ->renderHelp ($ view );
236+
237+ $ this ->assertMatchesXpath ($ html ,
238+ '/small
239+ [@id="name_help"]
240+ [@class="form-text text-muted"]
241+ [.="[trans]Help <b>text</b> test![/trans]"]
242+ '
243+ );
244+
245+ $ this ->assertMatchesXpath ($ html ,
246+ '/small
247+ [@id="name_help"]
248+ [@class="form-text text-muted"]
249+ /b
250+ [.="text"]
251+ ' , 0
252+ );
253+ }
254+
255+ public function testHelpHtmlIsTrue ()
256+ {
257+ $ form = $ this ->factory ->createNamed ('name ' , 'Symfony\Component\Form\Extension\Core\Type\TextType ' , null , [
258+ 'help ' => 'Help <b>text</b> test! ' ,
259+ 'help_html ' => true ,
260+ ]);
261+
262+ $ view = $ form ->createView ();
263+ $ html = $ this ->renderHelp ($ view );
264+
265+ $ this ->assertMatchesXpath ($ html ,
266+ '/small
267+ [@id="name_help"]
268+ [@class="form-text text-muted"]
269+ [.="[trans]Help <b>text</b> test![/trans]"]
270+ ' , 0
271+ );
272+
273+ $ this ->assertMatchesXpath ($ html ,
274+ '/small
275+ [@id="name_help"]
276+ [@class="form-text text-muted"]
277+ /b
278+ [.="text"]
279+ '
280+ );
281+ }
282+
200283 public function testErrors ()
201284 {
202285 $ form = $ this ->factory ->createNamed ('name ' , TextType::class);
0 commit comments