Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Accordion(
             AccordionSection(
                 "Writing well for the web",
                 HTML.p(
                     "This is the content for Writing well for the web."),
                 summary="An introduction to clear and concise writing.",
             ),
             AccordionSection(
                 "Writing well for specialists",
                 HTML.
                 p("This is the content for Writing well for specialists."),
             ),
             AccordionSection(
                 "Know your audience",
                 HTML.p("This is the content for Know your audience."),
             ),
             AccordionSection(
                 "How people read",
                 HTML.p("This is the content for How people read."),
             ),
         ))
Ejemplo n.º 2
0
def test_section_attributes():
    """Verify extra attributes can be added to an accordion section."""
    form = AccordionForm()
    form.helper.layout = Layout(
        Accordion(AccordionSection("Title", HTML("Contents"), key="value")))
    assert parse_form(form) == parse_contents(RESULT_DIR,
                                              "section_attributes.html")
Ejemplo n.º 3
0
def test_section_css_id():
    """Verify the accordion section id can be set."""
    form = AccordionForm()
    form.helper.layout = Layout(
        Accordion(AccordionSection("Title", HTML("Contents"),
                                   css_id="new_id")))
    assert parse_form(form) == parse_contents(RESULT_DIR,
                                              "section_css_id.html")
Ejemplo n.º 4
0
def test_section_css_class():
    """Verify an extra CSS class can be added to an accordion section."""
    form = AccordionForm()
    form.helper.layout = Layout(
        Accordion(
            AccordionSection("Title",
                             HTML("Contents"),
                             css_class="extra-css-class")))
    assert parse_form(form) == parse_contents(RESULT_DIR,
                                              "section_css_class.html")
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Accordion(
             AccordionSection(
                 "First section",
                 HTML("<p>First section contents.</p>"),
                 summary="A summary of the first section",
             ),
             AccordionSection(
                 "Second section",
                 HTML("<p>Second section contents.</p>"),
             ),
         ))
Ejemplo n.º 6
0
def test_attributes():
    """Verify extra attributes can be added."""
    form = AccordionForm()
    form.helper.layout = Layout(Accordion(key="value"))
    assert parse_form(form) == parse_contents(RESULT_DIR, "attributes.html")
Ejemplo n.º 7
0
def test_css_id():
    """Verify the accordion id can be set."""
    form = AccordionForm()
    form.helper.layout = Layout(Accordion(css_id="new-id"))
    assert parse_form(form) == parse_contents(RESULT_DIR, "css_id.html")
Ejemplo n.º 8
0
def test_css_class():
    """Verify an extra CSS class can be added."""
    form = AccordionForm()
    form.helper.layout = Layout(Accordion(css_class="extra-css-class"))
    assert parse_form(form) == parse_contents(RESULT_DIR, "css_class.html")