use of com.vaadin.client.flow.binding.SimpleElementBindingStrategy in project flow by vaadin.
the class GwtTemplateBinderTest method testRemoveTemplateFromDom.
public void testRemoveTemplateFromDom() {
int templateNodeId = 1;
TestElementTemplateNode templateNode = TestElementTemplateNode.create("span");
StateNode templateState = new StateNode(1, stateNode.getTree());
registerTemplateNode(templateNode, templateState, templateNodeId);
StateNode simpleNode = new StateNode(2, tree);
simpleNode.getMap(NodeFeatures.ELEMENT_DATA).getProperty(NodeProperties.TAG).setValue("div");
simpleNode.getList(NodeFeatures.ELEMENT_CHILDREN).add(0, templateState);
Element element = new SimpleElementBindingStrategy().create(simpleNode);
Binder.bind(simpleNode, element);
Reactive.flush();
assertEquals(1, element.getChildElementCount());
assertEquals("SPAN", element.getFirstElementChild().getTagName());
simpleNode.getList(NodeFeatures.ELEMENT_CHILDREN).splice(0, 1);
Reactive.flush();
assertEquals(0, element.getChildElementCount());
}
Aggregations