From f02a71014ec7044057432661672388a2dbab0c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 18 Nov 2024 09:55:39 +0100 Subject: [PATCH] fix: website core should be able to instantiate components --- addons/website/static/src/core/website_core.js | 3 --- addons/website/static/tests/core/website_core.test.js | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/addons/website/static/src/core/website_core.js b/addons/website/static/src/core/website_core.js index 31a959ce428b1..426529b4faf30 100644 --- a/addons/website/static/src/core/website_core.js +++ b/addons/website/static/src/core/website_core.js @@ -52,9 +52,6 @@ class WebsiteCore { }; this.owlApp = new App(null, appConfig); } - if (!this.active) { - return; - } const root = this.owlApp.createRoot(C, { props: null, env: this.env }); this.roots.push(root); const compElem = document.createElement("owl-component"); diff --git a/addons/website/static/tests/core/website_core.test.js b/addons/website/static/tests/core/website_core.test.js index 9a61b4351c641..ce87534ca5ad6 100644 --- a/addons/website/static/tests/core/website_core.test.js +++ b/addons/website/static/tests/core/website_core.test.js @@ -3,6 +3,7 @@ import { animationFrame } from "@odoo/hoot-mock"; import { Interaction } from "@website/core/interaction"; import { startInteraction } from "./helpers"; +import { Component, xml } from "@odoo/owl"; test("wait for translation before starting interactions", async () => { let flag = false; @@ -35,3 +36,13 @@ test("starting interactions twice should only actually do it once", async () => await animationFrame(); expect(n).toBe(1); }); + + +test("can mount a component", async () => { + class Test extends Component { + static selector = ".test"; + static template = xml`owl component`; + } + const {el} = await startInteraction(Test, `
`); + expect(el.querySelector(".test").innerHTML).toBe(`owl component`); +}); \ No newline at end of file