refactoring, work on environment

This commit is contained in:
Géry Debongnie
2019-01-23 14:28:41 +01:00
parent 08938d2334
commit 76fedae5a9
18 changed files with 138 additions and 63 deletions
+15
View File
@@ -651,6 +651,21 @@ describe("t-on", () => {
(<HTMLElement>node).click();
expect(a).toBe(6);
});
test("can bind handlers with loop variable as argument", () => {
expect.assertions(1);
const qweb = new QWeb();
qweb.addTemplate("test", `
<ul>
<li t-foreach="['someval']" t-as="action"><a t-on-click="activate(action)">link</a></li>
</ul>`);
const node = renderToDOM(qweb, "test", {
activate(action) {
expect(action).toBe('someval');
}
});
(<HTMLElement>node).getElementsByTagName('a')[0].click();
});
});