mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-01-23 18:00:00 +00:00
23 lines
619 B
JavaScript
23 lines
619 B
JavaScript
|
import test from "ava";
|
||
|
import TemplateRender from "../src/TemplateRender";
|
||
|
|
||
|
// Haml
|
||
|
test("Haml", t => {
|
||
|
t.is(new TemplateRender("haml").getEngineName(), "haml");
|
||
|
});
|
||
|
|
||
|
test("Haml Render", async t => {
|
||
|
let fn = await new TemplateRender("haml").getCompiledTemplate("%p= name");
|
||
|
t.is((await fn({ name: "Zach" })).trim(), "<p>Zach</p>");
|
||
|
});
|
||
|
|
||
|
test("Haml Render: with Library Override", async t => {
|
||
|
let tr = new TemplateRender("haml");
|
||
|
|
||
|
let lib = require("hamljs");
|
||
|
tr.engine.setLibrary(lib);
|
||
|
|
||
|
let fn = await tr.getCompiledTemplate("%p= name");
|
||
|
t.is((await fn({ name: "Zach" })).trim(), "<p>Zach</p>");
|
||
|
});
|