[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) <gdi@odoo.com>
This commit is contained in:
Arthur Detroux (ard)
2024-01-16 11:39:59 +00:00
parent 5b42a16a13
commit 94cae965a4
@@ -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");