Example #1
0
def border_collapse_tree():
    box = Box(
        title="Root",
        children=(
            Box(
                title="A",
                children=(
                    Box(title="AA", ),
                    Box(title="AB", ),
                ),
            ),
            Box(title="B", ),
        ),
    )
    box.available_height = 100
    box.available_width = 100
    return box
Example #2
0
def tree():
    box = Box(
        title="Root",
        style=Style(border_collapse=False),
        children=(
            Box(
                title="A",
                style=Style(border_collapse=False),
                children=(
                    Box(title="AA", ),
                    Box(title="AB", ),
                ),
            ),
            Box(title="B", ),
        ),
    )
    box.available_height = 100
    box.available_width = 100
    return box
Example #3
0
def test_add_children(tree):
    box1 = Box()
    box2 = Box()
    tree.add_children(box1, box2)
    assert box1.parent == tree
    assert box2.parent == tree
Example #4
0
def test_add_child(tree):
    box = Box()
    tree.add_child(box)
    assert box.parent == tree