From 94cae965a4eefe4cdf08fc7c66fbff7b64e83e86 Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Wed, 10 Jan 2024 09:43:18 +0100 Subject: [PATCH] [FIX] website: properly check if all snippets have their data-snippet Commit [1] changed the class from .ui-draggable to .o_draggable in the `snippet_version` test, specifically in the run function that checks if all snippets have their `[data-snippet]` properly set. Indeed, `.o_draggable` is set on the parents of draggable elements and not on the elements which are draggable themselves. This lead to a `.every` on an empty array which returns `true`, and therefore avoids the `console.error` but did not properly check the snippets. This commit changes the selector to all snippets which do not have a [data-module-id] which should be all snippets that are draggable. [1]: https://github.com/odoo/odoo/commit/7594d71ca8610d5947e80f325ccb57abc23c2c76 Related to task-3079246 closes odoo/odoo#148824 Signed-off-by: Guillaume Dieleman (gdi) --- addons/website/static/tests/tours/snippet_version.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website/static/tests/tours/snippet_version.js b/addons/website/static/tests/tours/snippet_version.js index 94a1ffc7427..94c6100d920 100644 --- a/addons/website/static/tests/tours/snippet_version.js +++ b/addons/website/static/tests/tours/snippet_version.js @@ -20,9 +20,9 @@ wTourUtils.registerWebsitePreviewTour("snippet_version", { trigger: '#oe_snippets .o_panel_body > .oe_snippet', run: function () { // Tests done here as all these are not visible on the page - const draggableSnippets = document.querySelectorAll('#oe_snippets .o_panel_body > .oe_snippet.o_draggable > :nth-child(2)'); - if (![...draggableSnippets].every(el => el.dataset.snippet)) { - console.error("error Some t-snippet are missing their template name"); + const draggableSnippets = [...document.querySelectorAll('#oe_snippets .o_panel_body > .oe_snippet:not([data-module-id]) > :nth-child(2)')]; + if (draggableSnippets.length && !draggableSnippets.every(el => el.dataset.snippet)) { + console.error("error Some t-snippet are missing their template name or there are no snippets to drop"); } if (!document.querySelector('#oe_snippets [data-snippet="s_test_snip"] [data-snippet="s_share"]')) { console.error("error s_share t-called inside s_test_snip is missing template name");