mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
refactoring, work on environment
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import Widget, {WidgetEnv} from "../src/ts/core/widget";
|
||||
import Widget, {WEnv} from "../src/ts/core/widget";
|
||||
import QWeb from "../src/ts/core/qweb_vdom";
|
||||
import { Type } from "../src/ts/types";
|
||||
|
||||
|
||||
type TestEnv = WidgetEnv;
|
||||
interface Type<T> extends Function {
|
||||
new (...args: any[]): T;
|
||||
}
|
||||
|
||||
type TestEnv = WEnv;
|
||||
type TestWidget = Widget<TestEnv>
|
||||
|
||||
function makeWidget(W: Type<TestWidget>): TestWidget {
|
||||
|
||||
Reference in New Issue
Block a user