Esempio n. 1
0
def test_button(document, comm):
    button = Button(name='Button')

    widget = button.get_root(document, comm=comm)

    assert isinstance(widget, button._widget_type)
    assert widget.label == 'Button'

    button._comm_change({'clicks': 1})
    assert button.clicks == 1
Esempio n. 2
0
def test_button(document, comm):
    button = Button(name='Button')

    box = button._get_model(document, comm=comm)

    assert isinstance(box, WidgetBox)

    widget = box.children[0]
    assert isinstance(widget, button._widget_type)
    assert widget.clicks == 0
    assert widget.label == 'Button'

    widget.clicks = 1
    button._comm_change({'clicks': widget.clicks})
    assert button.clicks == 1