mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] compiler: add support for t-on- on t-slots and t-set-slots
This commit is contained in:
committed by
Samuel Degueldre
parent
998ecbb337
commit
56086242bb
@@ -1378,6 +1378,25 @@ describe("qweb parser", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("a component with a named slot with t-on", async () => {
|
||||
expect(
|
||||
parse(`<MyComponent><t t-set-slot="name" t-on-click="doStuff">foo</t></MyComponent>`)
|
||||
).toEqual({
|
||||
type: ASTType.TComponent,
|
||||
name: "MyComponent",
|
||||
isDynamic: false,
|
||||
dynamicProps: null,
|
||||
props: {},
|
||||
on: null,
|
||||
slots: {
|
||||
name: {
|
||||
content: { type: ASTType.Text, value: "foo" },
|
||||
on: { click: "doStuff" },
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("a component with a named slot with div tag", async () => {
|
||||
expect(() =>
|
||||
parse(`<MyComponent><div t-set-slot="name">foo</div></MyComponent>`)
|
||||
@@ -1550,6 +1569,7 @@ describe("qweb parser", () => {
|
||||
type: ASTType.TSlot,
|
||||
name: "default",
|
||||
attrs: {},
|
||||
on: null,
|
||||
defaultContent: null,
|
||||
});
|
||||
});
|
||||
@@ -1559,10 +1579,21 @@ describe("qweb parser", () => {
|
||||
type: ASTType.TSlot,
|
||||
name: "header",
|
||||
attrs: {},
|
||||
on: null,
|
||||
defaultContent: { type: ASTType.Text, value: "default content" },
|
||||
});
|
||||
});
|
||||
|
||||
test("t-slot with t-on-", async () => {
|
||||
expect(parse(`<t t-slot="default" t-on-click.prevent="doSomething"/>`)).toEqual({
|
||||
type: ASTType.TSlot,
|
||||
name: "default",
|
||||
attrs: {},
|
||||
on: { "click.prevent": "doSomething" },
|
||||
defaultContent: null,
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// t-debug
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user