[IMP] slots: add support for t-props on slots props

This commit is contained in:
Géry Debongnie
2022-06-06 08:17:51 +02:00
committed by Sam Degueldre
parent 5d5a530505
commit 1fc88f626f
18 changed files with 202 additions and 139 deletions
+22
View File
@@ -74,6 +74,28 @@ describe("slots", () => {
expect(fixture.innerHTML).toBe("<span>other text</span>");
});
test("slot with slot scope and t-props", async () => {
class Child extends Component {
static template = xml`
<t t-slot="slotName" t-props="info"/>`;
info = { a: 1, b: 2 };
}
class Parent extends Component {
static template = xml`
<Child>
<t t-set-slot="slotName" t-slot-scope="info">
<p t-esc="info.a"/>
<p t-esc="info.b"/>
</t>
</Child>`;
static components = { Child };
}
await mount(Parent, fixture);
expect(fixture.innerHTML).toBe("<p>1</p><p>2</p>");
});
test("simple dynamic slot with slot scope", async () => {
let child: any;
class Child extends Component {