[FIX] component: allow fragments in method mount

It is now possible to mount components in fragments

closes #494
This commit is contained in:
Géry Debongnie
2019-11-22 14:49:37 +01:00
committed by aab-odoo
parent 7bb04185c7
commit 14db513f3b
3 changed files with 28 additions and 3 deletions
+11
View File
@@ -91,6 +91,17 @@ describe("basic widget properties", () => {
expect(fixture.innerHTML).toBe("<div>content</div>");
});
test("can be mounted on a documentFragment", async () => {
class SomeWidget extends Component<any, any> {
static template = xml`<div>content</div>`;
}
const widget = new SomeWidget();
await widget.mount(document.createDocumentFragment());
expect(fixture.innerHTML).toBe("");
await widget.mount(fixture);
expect(fixture.innerHTML).toBe("<div>content</div>");
});
test("display a nice message if mounted on a non existing node", async () => {
class SomeWidget extends Component<any, any> {
static template = xml`<div>content</div>`;