Exemplo n.º 1
0
 @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}));
 }
Exemplo n.º 2
0
 @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));
 }
Exemplo n.º 3
0
 @Test
 public void bool() throws IOException {
   Handlebars handlebars = new Handlebars();
   Template template = handlebars.compile("if ({{" + selector + "}})");
   assertEquals("if (true)", template.apply(true));
 }
Exemplo n.º 4
0
 @Test
 public void htmlString() throws IOException {
   Handlebars handlebars = new Handlebars();
   Template template = handlebars.compile("var s = '{{" + selector + "}}';");
   assertEquals("var s = '&lt;div&gt;';", template.apply("<div>"));
 }
Exemplo n.º 5
0
 @Test
 public void chHtml() throws IOException {
   Handlebars handlebars = new Handlebars();
   Template template = handlebars.compile("var s = '{{" + selector + "}}';");
   assertEquals("var s = '&lt;';", template.apply('<'));
 }
Exemplo n.º 6
0
 @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>")));
 }
Exemplo n.º 7
0
 @Test
 public void string() throws IOException {
   Handlebars handlebars = new Handlebars();
   Template template = handlebars.compile("var s = '{{" + selector + "}}';");
   assertEquals("var s = 'Hello';", template.apply("Hello"));
 }
Exemplo n.º 8
0
 @Test
 public void integer() throws IOException {
   Handlebars handlebars = new Handlebars();
   Template template = handlebars.compile("var i = {{" + selector + "}};");
   assertEquals("var i = 10;", template.apply(10));
 }