[FIX] portal: allow use of expression to describe portal target

Before this commit, the value of the `t-portal` directive was inserted
in the compiled template without being processed.
This commit is contained in:
Géry Debongnie
2022-05-03 15:15:53 +02:00
committed by Sam Degueldre
parent 0cd66c8518
commit 7137130c38
3 changed files with 41 additions and 1 deletions
+19
View File
@@ -67,6 +67,25 @@ describe("Portal", () => {
expect(fixture.innerHTML).toBe('<div id="outside"><p>2</p></div><div><span>1</span></div>');
});
test("basic use of portal, variation", async () => {
class Parent extends Component {
static template = xml`
<div>
<span>1</span>
<t t-portal="target">
<p>2</p>
</t>
</div>`;
target = "#outside";
}
addOutsideDiv(fixture);
await mount(Parent, fixture);
expect(fixture.innerHTML).toBe('<div id="outside"><p>2</p></div><div><span>1</span></div>');
});
test("basic use of portal on div", async () => {
class Parent extends Component {
static template = xml`