示例#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._process_event(None)
    assert button.clicks == 1
示例#2
0
def test_button_event(document, comm):
    button = Button(name='Button')

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

    events = []

    def callback(event):
        events.append(event.new)

    button.param.watch(callback, 'value')

    assert button.value == False
    button._process_event(ButtonClick(widget))
    assert events == [True]
    assert button.value == False