def _sidebar_items():
    return [
        pn.pane.Markdown("## Settings"),
        FastButton(name="Click Me"),
        FastCheckbox(name="Check Me"),
        FastSwitch(value=True,
                   checked_message="Checked",
                   unchecked_message="Unchecked"),
        _navigation_menu(),
    ]
Exemplo n.º 2
0
def test_constructor():
    # When
    switch = FastSwitch(name="Notify by Email", value=False, checked_message="On", unchecked_message="Off")
    # Then
    assert switch.name=="Notify by Email"
    assert switch.value is False
    assert switch.checked_message=="On"
    assert switch.unchecked_message=="Off"

    assert switch.disabled is False
    assert switch.readonly is False
Exemplo n.º 3
0
def _create_fast_switch_card():
    component = FastSwitch(
        name="Notify by Email",
        value=False,
        checked_message="On",
        unchecked_message="Off",
    )
    parameters = [
        "value",
        "name",
        "checked_message",
        "unchecked_message",
        "readonly",
    ]
    widgets = {
        "value": FastCheckbox,
        "checked_message": FastTextInput,
        "unchecked_message": FastTextInput,
        "readonly": FastCheckbox,
    }
    return _create_card(component=component, parameters=parameters, widgets=widgets)
Exemplo n.º 4
0
    # When
    switch = FastSwitch(name="Notify by Email", value=False, checked_message="On", unchecked_message="Off")
    # Then
    assert switch.name=="Notify by Email"
    assert switch.value is False
    assert switch.checked_message=="On"
    assert switch.unchecked_message=="Off"

    assert switch.disabled is False
    assert switch.readonly is False


if __name__.startswith("bokeh"):
    switch = FastSwitch(
        name="Notify by Email",
        value=False,
        checked_message="On",
        unchecked_message="Off",
    )
    app = create_fast_test_app(
        component=switch,
        parameters=[
            "name",
            "value",
            "checked_message",
            "unchecked_message",
            "required",
            "disabled",
            "readonly"
        ],
    )
    app.servable()