use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ComponentTest method wrappedComponentUsesElement.
@Test
public void wrappedComponentUsesElement() {
Element div = new Element("div");
div.setAttribute("id", "foo");
Assert.assertEquals(Optional.of("foo"), div.as(TestDiv.class).getId());
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ComponentTest method mapToComponentWithElementConstructor.
@Test
public void mapToComponentWithElementConstructor() {
Element e = new Element("my-element");
TestComponentWhichUsesElementConstructor c = Component.from(e, TestComponentWhichUsesElementConstructor.class);
Assert.assertSame(e, c.getElement());
Assert.assertSame(c, e.getComponent().get());
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ComponentTest method synchronizePropertyElementConstructor.
@Test
public void synchronizePropertyElementConstructor() {
SynchronizePropertyUsingElementConstructor component = new SynchronizePropertyUsingElementConstructor();
component.customInit();
Element element = component.getElement();
assertSynchronizedProperties(element, "foo");
assertSynchronizedPropertiesEvents(element, "change");
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ComponentTest method defaultGetChildrenMultiple.
@Test
public void defaultGetChildrenMultiple() {
// parent
// * level1
// ** child1
// ** child2
Element level1 = ElementFactory.createDiv("Level1");
parentDivComponent.getElement().appendChild(level1);
level1.appendChild(child1SpanComponent.getElement());
level1.appendChild(child2InputComponent.getElement());
assertChildren(parentDivComponent, child1SpanComponent, child2InputComponent);
}
use of com.vaadin.flow.dom.Element in project flow by vaadin.
the class ComponentTest method mapToComponentWhichCreatesComponentInConstructor.
@Test
public void mapToComponentWhichCreatesComponentInConstructor() {
Element e = new Element("div");
TestComponentWhichCreatesComponentInConstructor c = Component.from(e, TestComponentWhichCreatesComponentInConstructor.class);
Element buttonElement = c.getElement().getChild(0);
Assert.assertEquals(e, c.getElement());
Assert.assertNotEquals(e, buttonElement);
Assert.assertEquals("button", buttonElement.getTag());
}
Aggregations