use of com.vaadin.flow.template.angular.TextTemplateNode in project flow by vaadin.
the class DefaultTextModelBuiderFactoryTest method verifyStaticText.
private void verifyStaticText(List<TemplateNode> nodes, int index, String expected) {
Assert.assertEquals(TextTemplateNode.class, nodes.get(index).getClass());
TextTemplateNode textNode = (TextTemplateNode) nodes.get(index);
Assert.assertEquals(expected, textNode.getTextBinding().getValue(null));
}
use of com.vaadin.flow.template.angular.TextTemplateNode in project flow by vaadin.
the class AngularTemplateParserTest method parseParameterizedTextTemplate.
@Test
public void parseParameterizedTextTemplate() {
ElementTemplateNode rootNode = (ElementTemplateNode) parse("<div id='foo'>{{bar}}<input></div>");
Assert.assertEquals("div", rootNode.getTag());
Assert.assertEquals(1, rootNode.getAttributeNames().count());
Assert.assertEquals("foo", rootNode.getAttributeBinding("id").get().getValue(null));
Assert.assertEquals(2, rootNode.getChildCount());
TextTemplateNode textChild = (TextTemplateNode) rootNode.getChild(0);
BindingValueProvider binding = textChild.getTextBinding();
StateNode node = new StateNode(ModelMap.class);
// Explicitly set "bar" property to null. So model has property "bar".
// See #970
ModelMap.get(node).setValue("bar", null);
Assert.assertNull(binding.getValue(node));
String value = "someValue";
ModelMap.get(node).setValue("bar", value);
Assert.assertEquals(value, binding.getValue(node));
}
Aggregations