diff --git a/README.md b/README.md
index a35ebe84..ee05488c 100644
--- a/README.md
+++ b/README.md
@@ -44,4 +44,7 @@ Before even thinking about using this in a real scenario:
- check qweb tests and see if it is reasonable
- Note: the compilation of a template should have a unique node (but sub templates
can have multiple roots)
-- remove the "if (${exprID} || ${exprID} === 0) {"
\ No newline at end of file
+- remove the "if (${exprID} || ${exprID} === 0) {"
+- style is props? difference between props and attrs
+- text node
+- t-extend???
\ No newline at end of file
diff --git a/demo/src/RootWidget.ts b/demo/src/RootWidget.ts
index 36056a15..34364d4e 100644
--- a/demo/src/RootWidget.ts
+++ b/demo/src/RootWidget.ts
@@ -11,6 +11,10 @@ const template = `
`;
- const expected = `
`;
- expect(renderToString(template)).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", `
`);
+ const result = renderToString(qweb, "test");
+ expect(result).toBe(`
`);
});
test("dynamic attributes", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template)).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test");
+ expect(result).toBe(``);
});
test("fixed variable", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: "ok" })).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", { value: "ok" });
+ expect(result).toBe(``);
});
test("dynamic attribute falsy variable ", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: false })).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", { value: false });
+ expect(result).toBe(``);
});
test("tuple literal", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template)).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test");
+ expect(result).toBe(``);
});
test("tuple variable", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: ["foo", "bar"] })).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", { value: ["foo", "bar"] });
+ expect(result).toBe(``);
});
test("object", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: { a: 1, b: 2, c: 3 } })).toBe(
- expected
- );
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", {
+ value: { a: 1, b: 2, c: 3 }
+ });
+ expect(result).toBe(``);
});
test("format literal", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template)).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test");
+ expect(result).toBe(``);
});
test("format value", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: "a" })).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", { value: "a" });
+ expect(result).toBe(``);
});
test("format expression", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value: 5 })).toBe(expected);
+ const qweb = new QWeb();
+ qweb.addTemplate("test", ``);
+ const result = renderToString(qweb, "test", { value: 5 });
+ expect(result).toBe(``);
});
test("format multiple", () => {
- const template = ``;
- const expected = ``;
- expect(renderToString(template, { value1: 0, value2: 1, value3: 2 })).toBe(
- expected
+ const qweb = new QWeb();
+ qweb.addTemplate(
+ "test",
+ ``
);
+ const result = renderToString(qweb, "test", {
+ value1: 0,
+ value2: 1,
+ value3: 2
+ });
+ expect(result).toBe(``);
});
test.skip("various escapes", () => {
- // need to think about this... This one does not pass, but I am not sure it is
- // a correct test
- const template = `
-
- `;
+ // not needed??
+ const qweb = new QWeb();
+ qweb.addTemplate(
+ "test",
+ `
+
+ `
+ );
+ const result = renderToString(qweb, "test", {
+ bar: 0,
+ baz: 1,
+ qux: { qux: "<>" }
+ });
const expected = ``;
- expect(
- renderToString(template, { bar: 0, baz: 1, qux: { qux: "<>" } })
- ).toBe(expected);
+ expect(result).toBe(expected);
});
});
@@ -333,14 +409,14 @@ describe("t-call (template calling", () => {
qweb.addTemplate("_basic-callee", "