Search in sources :

Example 21 with Style

use of com.vaadin.flow.dom.Style in project flow by vaadin.

the class ElementTest method nullStyleValue.

@Test
public void nullStyleValue() {
    Element element = ElementFactory.createDiv();
    Style style = element.getStyle();
    style.set("borderColor", "blue");
    style.set("borderColor", null);
    List<String> styles = style.getNames().collect(Collectors.toList());
    Assert.assertFalse(styles.contains("borderColor"));
}
Also used : Element(com.vaadin.flow.dom.Element) Style(com.vaadin.flow.dom.Style) Test(org.junit.Test)

Example 22 with Style

use of com.vaadin.flow.dom.Style in project flow by vaadin.

the class ElementTest method getNullStyle.

@Test(expected = IllegalArgumentException.class)
public void getNullStyle() {
    Element e = ElementFactory.createDiv();
    Style s = e.getStyle();
    s.get(null);
}
Also used : Element(com.vaadin.flow.dom.Element) Style(com.vaadin.flow.dom.Style) Test(org.junit.Test)

Aggregations

Style (com.vaadin.flow.dom.Style)22 Element (com.vaadin.flow.dom.Element)20 Test (org.junit.Test)17 Text (com.vaadin.flow.component.Text)1 Div (com.vaadin.flow.component.html.Div)1 Input (com.vaadin.flow.component.html.Input)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 ElementFactory (com.vaadin.flow.dom.ElementFactory)1 StateNode (com.vaadin.flow.internal.StateNode)1 ElementStylePropertyMap (com.vaadin.flow.internal.nodefeature.ElementStylePropertyMap)1 Route (com.vaadin.flow.router.Route)1 Registration (com.vaadin.flow.shared.Registration)1 ViewTestLayout (com.vaadin.flow.uitest.servlet.ViewTestLayout)1 JsonObject (elemental.json.JsonObject)1 Set (java.util.Set)1