diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 0982a88739b..dd6ca884ff7 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2559,7 +2559,7 @@ var SnippetsMenu = Widget.extend({ // their descendant snippets. const rootInvisibleSnippetEls = [...$invisibleSnippets].filter(invisibleSnippetEl => { const ancestorInvisibleEl = invisibleSnippetEl - .parentElement.closest(".o_snippet_invisible"); + .parentElement.closest(invisibleSelector); if (!ancestorInvisibleEl) { return true; } diff --git a/addons/website/static/tests/tours/conditional_visibility.js b/addons/website/static/tests/tours/conditional_visibility.js index c4c884ef372..630cde16172 100644 --- a/addons/website/static/tests/tours/conditional_visibility.js +++ b/addons/website/static/tests/tours/conditional_visibility.js @@ -181,3 +181,70 @@ wTourUtils.clickOnSnippet(snippets[1]), run: () => {}, // it is a check }, ]); + +wTourUtils.registerWebsitePreviewTour("conditional_visibility_5", { + edition: true, + test: true, + url: "/", +}, () => [ + wTourUtils.dragNDrop(snippets[0]), + { + content: "Click on the image of the dragged snippet", + trigger: "iframe .s_text_image img", + }, + wTourUtils.changeOption("DeviceVisibility", 'we-button[data-toggle-device-visibility="no_desktop"]'), + { + content: "Check that the Column has been added in the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel .o_we_invisible_entry:contains('Column')", + run: () => {}, // it is a check + }, + { + content: "Click on the 'Text - Image' snippet", + trigger: "iframe .s_text_image", + }, + wTourUtils.changeOption("ConditionalVisibility", 'we-button[data-toggle-device-visibility="no_desktop"]'), + { + content: "Check that the 'Text - Image' is the parent of 'Column' in the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel .o_we_invisible_root_parent.o_we_invisible_entry:contains('Text - Image') + ul .o_we_invisible_entry.o_we_sublevel_1:contains('Column')", + run: () => {}, // it is a check + }, + { + content: "Click on the 'Text - Image' entry on the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel .o_we_invisible_root_parent.o_we_invisible_entry:contains('Text - Image')", + }, + { + content: "Check that the snippet is visible on the website", + trigger: "iframe .s_text_image.o_snippet_desktop_invisible.o_snippet_override_invisible", + run: () => {}, // it is a check + }, + wTourUtils.changeOption("ConditionalVisibility", 'we-button[data-toggle-device-visibility="no_mobile"]'), + { + content: "Check that the 'Text - Image' has been removed from the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel:not(.o_we_invisible_entry:contains('Text - Image'))", + run: () => {}, // it is a check + }, + { + content: "Click on the 'Column' entry on the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel .o_we_invisible_entry:contains('Column')", + }, + { + content: "Check that the column is visible on the website", + trigger: "iframe .s_text_image .row > .o_snippet_desktop_invisible.o_snippet_override_invisible", + run: () => {}, // it is a check + }, + wTourUtils.changeOption("DeviceVisibility", 'we-button[data-toggle-device-visibility="no_mobile"]'), + { + content: "Check that the column has been removed from the 'Invisible Elements' panel", + trigger: "#oe_snippets:not(:has(.o_we_invisible_entry:contains('Column')))", + run: () => {}, // it is a check + }, + { + content: "Activate mobile preview", + trigger: ".o_we_website_top_actions button[data-action='mobile']", + }, + { + content: "Check that the 'Text - Image' is the parent of 'Column' in the 'Invisible Elements' panel", + trigger: ".o_we_invisible_el_panel .o_we_invisible_root_parent.o_we_invisible_entry:contains('Text - Image') + ul .o_we_invisible_entry.o_we_sublevel_1:contains('Column')", + run: () => {}, // it is a check + }, +]); diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index 88e5333255d..0ed5d2ea741 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -305,6 +305,7 @@ class TestUi(odoo.tests.HttpCase): self.start_tour('/web', 'conditional_visibility_2', login='admin') self.start_tour(self.env['website'].get_client_action_url('/'), 'conditional_visibility_3', login='admin') self.start_tour(self.env['website'].get_client_action_url('/'), 'conditional_visibility_4', login='admin') + self.start_tour(self.env['website'].get_client_action_url('/'), 'conditional_visibility_5', login='admin') def test_11_website_snippet_background_edition(self): self.env['ir.attachment'].create({