use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ElementTest method callFunctionBeforeReAttach.
@Test
public void callFunctionBeforeReAttach() {
UI ui = new UI();
Element element = ElementFactory.createDiv();
ui.getElement().appendChild(element);
element.callFunction("noArgsMethod");
Element div = ElementFactory.createDiv();
ui.getElement().appendChild(div);
div.appendChild(element);
ui.getInternals().getStateTree().runExecutionsBeforeClientResponse();
assertPendingJs(ui, "$0.noArgsMethod()", element);
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ElementTest method attributesNamesAfterRemoved.
@Test
public void attributesNamesAfterRemoved() {
Element e = ElementFactory.createDiv();
e.setAttribute("foo", "bar");
e.setAttribute("bar", "baz");
e.removeAttribute("foo");
Assert.assertArrayEquals(new String[] { "bar" }, e.getAttributeNames().toArray());
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ElementTest method setStyleAttributeTrailingSemicolon.
@Test
public void setStyleAttributeTrailingSemicolon() {
Element e = ElementFactory.createDiv();
String style = "width:12em";
e.setAttribute("style", style + ";");
Assert.assertEquals(style, e.getAttribute("style"));
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ElementTest method setBooleanAttribute.
@Test
public void setBooleanAttribute() {
Element e = ElementFactory.createDiv();
e.setAttribute("foo", true);
Assert.assertEquals("", e.getAttribute("foo"));
Assert.assertTrue(e.hasAttribute("foo"));
e.setAttribute("foo", false);
Assert.assertEquals(null, e.getAttribute("foo"));
Assert.assertFalse(e.hasAttribute("foo"));
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ElementUtilTest method attachToComponent.
@Test
public void attachToComponent() {
Element e = ElementFactory.createDiv();
Component c = Mockito.mock(Component.class);
ElementUtil.setComponent(e, c);
Assert.assertEquals(c, e.getComponent().get());
}
Aggregations