Add help texts for checkboxes in horizontal bootstrap 4 forms

This commit is contained in:
Jannik Zschiesche 2018-08-02 11:42:21 +02:00
parent d0a97b40ae
commit 1483c87aab
2 changed files with 21 additions and 0 deletions

View File

@ -81,6 +81,7 @@ col-sm-10
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_help(form) -}}
{{- form_errors(form) -}}
</div>{#--#}
</div>

View File

@ -214,4 +214,24 @@ abstract class AbstractBootstrap4HorizontalLayoutTest extends AbstractBootstrap4
$this->assertMatchesXpath($html, '/div[@class="form-group row"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
}
public function testCheckboxRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$view = $form->createView();
$html = $this->renderRow($view, array('label' => 'foo', 'help' => 'really helpful text'));
$this->assertMatchesXpath($html,
'/div
[@class="form-group row"]
[
./div[@class="col-sm-2" or @class="col-sm-10"]
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
[
./small[text() = "[trans]really helpful text[/trans]"]
]
]
'
);
}
}