示例#1
0
def test_change_legend_size():
    """Verify size of the field legend can be changed from the default."""
    form = RadiosForm()
    form.helper = FormHelper()
    form.helper.layout = Layout(
        Field("method", context={"legend_size": Size.for_legend("l")}))
    assert parse_form(form) == parse_contents(RESULT_DIR, "legend_size.html")
示例#2
0
def test_show_legend_as_heading():
    """Verify the field legend can be displayed as the page heading."""
    form = RadiosForm()
    form.helper = FormHelper()
    form.helper.layout = Layout(Field("method", context={"legend_tag": "h1"}))
    assert parse_form(form) == parse_contents(RESULT_DIR,
                                              "legend_heading.html")
示例#3
0
def test_small():
    """Verify size of the radio buttons can be changed."""
    form = RadiosForm()
    form.helper = FormHelper()
    form.helper.layout = Layout(Field("method", context={"radios_small":
                                                         True}))
    assert parse_form(form) == parse_contents(RESULT_DIR, "buttons_small.html")
示例#4
0
def test_inline():
    """Verify radio buttons can be displayed in a row."""
    form = RadiosForm()
    form.helper = FormHelper()
    form.helper.layout = Layout(
        Field("method", context={"radios_inline": True}))
    assert parse_form(form) == parse_contents(RESULT_DIR,
                                              "buttons_inline.html")
示例#5
0
def test_initial_attributes():
    """Verify all the gds attributes are displayed."""
    form = RadiosForm(initial={"method": "email"})
    form.helper = FormHelper()
    form.helper.layout = Layout(Field.radios("method"))
    assert parse_form(form) == parse_contents(RESULT_DIR, "initial.html")