mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: slot are called with a specific and different key
This commit is contained in:
committed by
Aaron Bohy
parent
6a7703ea82
commit
cec451fd15
@@ -1544,4 +1544,49 @@ describe("slots", () => {
|
||||
}
|
||||
await mount(Parent, fixture);
|
||||
});
|
||||
|
||||
test("slot content has different key from other content -- static slot", async () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<div t-esc="props.parent" />`;
|
||||
}
|
||||
|
||||
class SlotDisplay extends Component {
|
||||
static components = { Child };
|
||||
static template = xml`<Child parent="'SlotDisplay'" /><t t-slot="default" />`;
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static components = { Child, SlotDisplay };
|
||||
static template = xml`
|
||||
<SlotDisplay>
|
||||
<Child parent="'Parent'" />
|
||||
</SlotDisplay>`;
|
||||
}
|
||||
|
||||
await mount(Parent, fixture);
|
||||
expect(fixture.innerHTML).toBe("<div>SlotDisplay</div><div>Parent</div>");
|
||||
});
|
||||
|
||||
test("slot content has different key from other content -- dynamic slot", async () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<div t-esc="props.parent" />`;
|
||||
}
|
||||
|
||||
class SlotDisplay extends Component {
|
||||
static components = { Child };
|
||||
slotName = "default";
|
||||
static template = xml`<Child parent="'SlotDisplay'" /><t t-slot="{{ slotName }}" />`;
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static components = { Child, SlotDisplay };
|
||||
static template = xml`
|
||||
<SlotDisplay>
|
||||
<Child parent="'Parent'" />
|
||||
</SlotDisplay>`;
|
||||
}
|
||||
|
||||
await mount(Parent, fixture);
|
||||
expect(fixture.innerHTML).toBe("<div>SlotDisplay</div><div>Parent</div>");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user