[FIX] compiler: properly handle <t> tags in some cases

The problem was that the compiler is based on the assumption that the
multi block received by the parser only occurs in some cases
where the structure of the template require a multi block, and it does
not work when we have random multiblock elsewhere.

We could fix the issue by modifying the code generator code to support
these usecases, or by simply removing these cases in the parser. Since
this seems more efficient, this is the approach taken by this commit.

Note that it was a good opportunity to simplify the parser.
This commit is contained in:
Géry Debongnie
2021-12-15 14:34:58 +01:00
committed by Mathieu Duckerts-Antoine
parent 424bc480e2
commit d7de25e867
5 changed files with 166 additions and 41 deletions
+7
View File
@@ -76,4 +76,11 @@ describe("multi blocks", () => {
mount(text(multi([text("a"), text("b")]) as any), fixture);
expect(fixture.innerHTML).toBe("ab");
});
test("multi inside a block", async () => {
const block = createBlock("<div><block-child-0/></div>");
const tree = block([], [multi([text("foo"), text("bar")])]);
mount(tree, fixture);
expect(fixture.innerHTML).toBe("<div>foobar</div>");
});
});