use of com.vaadin.flow.template.angular.BindingValueProvider in project flow by vaadin.
the class AngularTemplateParserTest method parseTemplateAttribute.
@Test
public void parseTemplateAttribute() {
ElementTemplateNode rootNode = (ElementTemplateNode) parse("<input [attr.value]='foo'></input>");
Assert.assertEquals("input", rootNode.getTag());
Assert.assertEquals(1, rootNode.getAttributeNames().count());
Assert.assertEquals(0, rootNode.getClassNames().count());
Assert.assertEquals(0, rootNode.getPropertyNames().count());
Optional<BindingValueProvider> binding = rootNode.getAttributeBinding("value");
Assert.assertTrue(binding.isPresent());
StateNode node = new StateNode(ModelMap.class);
// Explicitly set "foo" property to null. So model has property "foo".
// See #970
ModelMap.get(node).setValue("foo", null);
Assert.assertNull(binding.get().getValue(node));
ModelMap.get(node).setValue("foo", "bar");
Assert.assertEquals("bar", binding.get().getValue(node));
}
Aggregations