use of io.vertx.ext.web.common.template.TemplateEngine in project vertx-web by vert-x3.
the class HTTLTemplateEngineTest method testTemplateHandlerNoExtension.
@Test
public void testTemplateHandlerNoExtension(TestContext should) {
TemplateEngine engine = HTTLTemplateEngine.create(vertx);
final JsonObject context = new JsonObject().put("foo", "badger").put("bar", "fox");
engine.render(context, "somedir/test-httl-template1", should.asyncAssertSuccess(render -> {
should.assertEquals("<!-- -->\nHello badger and fox\n", normalizeCRLF(render.toString()));
}));
}
use of io.vertx.ext.web.common.template.TemplateEngine in project vertx-web by vert-x3.
the class HTTLTemplateEngineTest method testTemplateHandlerChangeExtension.
@Test
public void testTemplateHandlerChangeExtension(TestContext should) {
TemplateEngine engine = HTTLTemplateEngine.create(vertx, "mvl");
final JsonObject context = new JsonObject().put("foo", "badger").put("bar", "fox");
engine.render(context, "somedir/test-httl-template1", should.asyncAssertSuccess(render -> {
should.assertEquals("<!-- -->\nCheerio badger and fox\n", normalizeCRLF(render.toString()));
}));
}
use of io.vertx.ext.web.common.template.TemplateEngine in project vertx-web by vert-x3.
the class FreeMarkerTemplateTest method testTemplateHandlerNoExtension.
@Test
public void testTemplateHandlerNoExtension(TestContext should) {
TemplateEngine engine = FreeMarkerTemplateEngine.create(vertx);
final JsonObject context = new JsonObject().put("foo", "badger").put("bar", "fox");
context.put("context", new JsonObject().put("path", "/test-freemarker-template2.ftl"));
engine.render(context, "somedir/test-freemarker-template2", should.asyncAssertSuccess(render -> {
should.assertEquals("Hello badger and fox\nRequest path is /test-freemarker-template2.ftl\n", normalizeCRLF(render.toString()));
}));
}
use of io.vertx.ext.web.common.template.TemplateEngine in project vertx-web by vert-x3.
the class FreeMarkerTemplateTest method testTemplateHandlerChangeExtension.
@Test
public void testTemplateHandlerChangeExtension(TestContext should) {
TemplateEngine engine = FreeMarkerTemplateEngine.create(vertx, "mvl");
final JsonObject context = new JsonObject().put("foo", "badger").put("bar", "fox");
context.put("context", new JsonObject().put("path", "/test-freemarker-template2.ftl"));
engine.render(context, "somedir/test-freemarker-template2", should.asyncAssertSuccess(render -> {
should.assertEquals("Cheerio badger and fox\nRequest path is /test-freemarker-template2.ftl\n", normalizeCRLF(render.toString()));
}));
}
use of io.vertx.ext.web.common.template.TemplateEngine in project vertx-web by vert-x3.
the class JadeTemplateTest method testTemplateHandlerNoExtension.
@Test
public void testTemplateHandlerNoExtension(TestContext should) {
TemplateEngine engine = JadeTemplateEngine.create(vertx);
final JsonObject context = new JsonObject().put("foo", "badger").put("bar", "fox");
context.put("context", new JsonObject().put("path", "/test-jade-template2.jade"));
engine.render(context, "somedir/test-jade-template2", should.asyncAssertSuccess(render -> {
should.assertEquals("<!DOCTYPE html><html><head><title>badger/test-jade-template2.jade</title></head><body></body></html>", normalizeCRLF(render.toString()));
}));
}
Aggregations