def test_bs4_modal_no_kwargs(self): form = SampleForm() form.helper = FormHelper() form.helper.layout = Layout(Modal(Field("first_name"))) print(parse_form(form)) assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/bootstrap_modal_no_kwargs.html")
def test_grouped_checkboxes_radios(self): form = GroupedChoiceForm() form.helper = FormHelper() form.helper.layout = Layout("checkbox_select_multiple") assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/test_grouped_checkboxes.html") form.helper.layout = Layout("radio") assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/test_grouped_radios.html") form = GroupedChoiceForm({}) form.helper = FormHelper() form.helper.layout = Layout("checkbox_select_multiple") assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/test_grouped_checkboxes_failing.html" ) form.helper.layout = Layout("radio") assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/test_grouped_radios_failing.html")
def test_bs4_modal_with_kwargs(self): form = SampleForm() form.helper = FormHelper() form.helper.layout = Layout( Modal( Field("first_name"), css_id="id_test", css_class="test-class", title="This is my modal", title_id="id_title_test", title_class="text-center", )) assert parse_form(form) == parse_expected( "bootstrap4/test_layout_objects/bootstrap_modal_with_kwargs.html")
def test_field_with_buttons(self, settings): form = SampleForm() form.helper = FormHelper() form.helper.layout = Layout( FieldWithButtons( Field("password1", css_class="span4"), StrictButton("Go!", css_id="go-button"), StrictButton("No!", css_class="extra"), StrictButton("Test", type="submit", name="whatever", value="something"), css_class="extra", autocomplete="off", input_size="input-group-sm", )) assert parse_form(form) == parse_expected( f"{settings.CRISPY_TEMPLATE_PACK}/test_layout_objects/test_field_with_buttons.html" )