@Test public void list() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("{{#" + selector + "}}{{" + selector + "}} {{/" + selector + "}}"); assertEquals("1 2 3 ", template.apply(new Object[] {1, 2, 3})); }
@Test public void decimal() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var d = {{" + selector + "}};"); assertEquals("var d = 1.34;", template.apply(1.34)); }
@Test public void bool() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("if ({{" + selector + "}})"); assertEquals("if (true)", template.apply(true)); }
@Test public void htmlString() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var s = '{{" + selector + "}}';"); assertEquals("var s = '<div>';", template.apply("<div>")); }
@Test public void chHtml() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var s = '{{" + selector + "}}';"); assertEquals("var s = '<';", template.apply('<')); }
@Test public void safeString() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var s = '{{" + selector + "}}';"); assertEquals("var s = '<div>';", template.apply(new Handlebars.SafeString("<div>"))); }
@Test public void string() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var s = '{{" + selector + "}}';"); assertEquals("var s = 'Hello';", template.apply("Hello")); }
@Test public void integer() throws IOException { Handlebars handlebars = new Handlebars(); Template template = handlebars.compile("var i = {{" + selector + "}};"); assertEquals("var i = 10;", template.apply(10)); }