From cf90b56c3cd8a8a7012cded0cf7690fc63e3190f Mon Sep 17 00:00:00 2001 From: "Michael Mattiello (mcm)" Date: Tue, 26 May 2020 11:04:40 +0000 Subject: [FIX] web: mount owl renderer once Before this commit, owl renderers were mounted twice. This commit makes owl renderers mounted just once as it should be X-original-commit: 9234aa5c5c7de2f7af23071a3ff76adf93e9cee7 --- .../tests/views/abstract_controller_tests.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'addons/web/static/tests/views/abstract_controller_tests.js') diff --git a/addons/web/static/tests/views/abstract_controller_tests.js b/addons/web/static/tests/views/abstract_controller_tests.js index 09b95abddda..43b71b5293a 100644 --- a/addons/web/static/tests/views/abstract_controller_tests.js +++ b/addons/web/static/tests/views/abstract_controller_tests.js @@ -134,5 +134,35 @@ QUnit.module("Views", { assert.hasClass(document.activeElement, "o_searchview_input"); view.destroy(); }); + + QUnit.test('Owl Renderer mounted/willUnmount hooks are properly called', async function (assert) { + // This test could be removed as soon as controllers and renderers will + // both be converted in Owl. + assert.expect(3); + + class Renderer extends AbstractRenderer { + mounted() { + assert.step("mounted"); + } + willUnmount() { + assert.step("unmounted"); + } + } + Renderer.template = xml`
Test
`; + + const view = await createView({ + View: getOwlView(Renderer, "test"), + data: this.data, + model: "test_model", + arch: "", + }); + + view.destroy(); + + assert.verifySteps([ + "mounted", + "unmounted", + ]); + }); }); }); -- cgit v1.2.3