Exemple #1
0
def test_existing_css_classes():
    """Test that an alert can change alert_type"""
    alert = Alert(text="This is some text", css_classes=["important"])
    assert set(alert.css_classes) == {"alert", f"alert-{Alert.param.alert_type.default}", "important"}

    alert.alert_type="info"
    assert set(alert.css_classes) == {"alert", "alert-info", "important"}
Exemple #2
0
def test_alert_type_change(alert_type, document, comm):
    """Test that an alert can change alert_type"""
    alert = Alert(text="This is some text")

    model = alert.get_root(document, comm)

    alert.alert_type = alert_type
    assert set(alert.css_classes) == {"alert", f"alert-{alert_type}"}
    assert set(model.css_classes) == {"alert", f"alert-{alert_type}", "markdown"}
Exemple #3
0
def test_alert_type_change(alert_type):
    """Test that an alert can change alert_type"""
    alert = Alert(text="This is some text")

    alert.alert_type = alert_type
    assert set(alert.css_classes) == {"alert", f"alert-{alert_type}"}