Search in sources :

Example 1 with TemplateMap

use of com.vaadin.flow.internal.nodefeature.TemplateMap in project flow by vaadin.

the class TemplateElementStateProviderTest method clearChildSlot_resetChild.

public void clearChildSlot_resetChild() {
    Element parent = createElement("<div>@child@</div>");
    Element child = ElementFactory.createSpan("child");
    TemplateMap templateMap = parent.getNode().getFeature(TemplateMap.class);
    templateMap.setChild(child.getNode());
    Assert.assertEquals(1, parent.getChildCount());
    templateMap.setChild(null);
    Assert.assertEquals(0, parent.getChildCount());
    Assert.assertEquals(0, parent.getChildren().count());
    Assert.assertNull(child.getParent());
}
Also used : TemplateMap(com.vaadin.flow.internal.nodefeature.TemplateMap) Element(com.vaadin.flow.dom.Element)

Aggregations

Element (com.vaadin.flow.dom.Element)1 TemplateMap (com.vaadin.flow.internal.nodefeature.TemplateMap)1