use of com.vaadin.flow.dom.Style in project flow by vaadin.
the class ElementTest method assertClientStyleKey.
private void assertClientStyleKey(String sentToClient, String setUsingStyleApi) {
Element element = ElementFactory.createDiv();
StateNode stateNode = element.getNode();
ElementStylePropertyMap map = stateNode.getFeature(ElementStylePropertyMap.class);
Style style = element.getStyle();
style.set(setUsingStyleApi, "foo");
Assert.assertEquals("foo", style.get(setUsingStyleApi));
Assert.assertEquals(sentToClient, map.getPropertyNames().toArray()[0]);
Assert.assertEquals("foo", map.getProperty(sentToClient));
}
use of com.vaadin.flow.dom.Style in project flow by vaadin.
the class ElementTest method getSingleStyleAsAttribute.
@Test
public void getSingleStyleAsAttribute() {
Element e = ElementFactory.createDiv();
Style s = e.getStyle();
s.set("border", "1px solid black");
Assert.assertTrue(e.hasAttribute("style"));
Assert.assertEquals("border:1px solid black", e.getAttribute("style"));
}
use of com.vaadin.flow.dom.Style in project flow by vaadin.
the class ElementTest method dashSeparatedGetStyle.
@Test
public void dashSeparatedGetStyle() {
Element element = ElementFactory.createDiv();
Style style = element.getStyle();
style.set("borderColor", "blue");
style.set("border-foo", "bar");
Assert.assertEquals("blue", style.get("border-color"));
Assert.assertEquals("bar", style.get("border-foo"));
}
use of com.vaadin.flow.dom.Style in project flow by vaadin.
the class ElementTest method dashSeparatedSetStyle.
@Test
public void dashSeparatedSetStyle() {
Element element = ElementFactory.createDiv();
Style style = element.getStyle();
style.set("border-color", "blue");
Assert.assertEquals("blue", style.get("border-color"));
}
use of com.vaadin.flow.dom.Style in project flow by vaadin.
the class ElementTest method removeStyleAttribute.
@Test
public void removeStyleAttribute() {
Element element = ElementFactory.createDiv();
Style style = element.getStyle();
style.set("border", "1px solid green");
element.removeAttribute("style");
Assert.assertEquals(0, style.getNames().count());
}
Aggregations