Search in sources :

Example 6 with ModelValueBindingProvider

use of com.vaadin.flow.template.angular.ModelValueBindingProvider in project flow by vaadin.

the class TemplateElementStateProviderTest method testElementSubProperty.

@Test
public void testElementSubProperty() {
    String modelPath = "bean.name";
    ElementTemplateBuilder builder = new ElementTemplateBuilder("div").setProperty("prop", new ModelValueBindingProvider(modelPath));
    Element element = createElement(builder);
    StateNode stateNode = element.getNode();
    ModelMap.get(stateNode).resolveModelMap("bean").setValue("name", "John");
    Assert.assertEquals("John", element.getProperty("prop"));
}
Also used : ElementTemplateBuilder(com.vaadin.flow.template.angular.ElementTemplateBuilder) Element(com.vaadin.flow.dom.Element) StateNode(com.vaadin.flow.internal.StateNode) ModelValueBindingProvider(com.vaadin.flow.template.angular.ModelValueBindingProvider) Test(org.junit.Test)

Aggregations

ModelValueBindingProvider (com.vaadin.flow.template.angular.ModelValueBindingProvider)6 StateNode (com.vaadin.flow.internal.StateNode)5 Test (org.junit.Test)5 Element (com.vaadin.flow.dom.Element)4 ElementTemplateBuilder (com.vaadin.flow.template.angular.ElementTemplateBuilder)4 JsonObject (elemental.json.JsonObject)2 JsonValue (elemental.json.JsonValue)1