Пример #1
0
def widget_layout_errors(fixture):
    """A Layout can only be used with a single Widget, and a Widget can only have a single Layout."""

    widget_with_layout = Div(fixture.view).use_layout(Layout())

    with expected(ProgrammerError):
        widget_with_layout.use_layout(Layout())

    re_used_layout = Layout()
    widget_with_reused_layout = Div(fixture.view).use_layout(re_used_layout)
    with expected(ProgrammerError):
        Div(fixture.view).use_layout(re_used_layout)
Пример #2
0
def page_layout_content_layout(fixture):
    """A PageLayout can be given a Layout it should use to lay out its contents Div."""

    contents_layout = Layout()
    widget = HTML5Page(fixture.view).use_layout(
        PageLayout(contents_layout=contents_layout))

    vassert(widget.layout.contents.layout is contents_layout)
Пример #3
0
def test_page_layout_content_layout(web_fixture):
    """A PageLayout can be given a Layout it should use to lay out its contents Div."""

    fixture = web_fixture

    contents_layout = Layout()
    widget = HTML5Page(fixture.view).use_layout(
        PageLayout(contents_layout=contents_layout))

    assert widget.layout.contents.layout is contents_layout