[FIX] app, components: dynamic t-call should propagate the key

Have a Component which has a Component node, and a dynamic t-call itself having
a Component node.

Before this commit, both children had the same `key`, (as in the key in parent.children, which registers on the parent all its children).

As a result, the scheduler was endlessly hanging.

After this commit, it works as expected.
This commit is contained in:
Lucas Perais (lpe)
2022-01-10 15:20:13 +01:00
committed by Aaron Bohy
parent 3e1fe07ba7
commit 4b170b9b45
3 changed files with 65 additions and 2 deletions
+23
View File
@@ -183,4 +183,27 @@ describe("t-call", () => {
fixture.querySelector("p")!.click();
expect(value).toBe(3);
});
test("dynamic t-call: key is propagated", async () => {
let childId = 0;
class Child extends Component {
static template = xml`<div t-att-id="id" />`;
id: any;
setup() {
this.id = childId++;
}
}
const sub = xml`<Child />`;
class Parent extends Component {
static template = xml`<Child /><t t-call="{{ sub }}"/>`;
static components = { Child };
sub = sub;
}
await mount(Parent, fixture);
expect(fixture.innerHTML).toBe(`<div id="0"></div><div id="1"></div>`);
});
});