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 ce61a023202..982d7d4b8f9 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -491,6 +491,7 @@ var SnippetEditor = Widget.extend({ return el.matches(this.layoutElementsSelector); }); return isEmpty && !$el.hasClass('oe_structure') && !$el.hasClass('oe_unremovable') + && !$el.parent().hasClass('carousel-item') && (!editor || editor.isTargetParentEditable); }; diff --git a/addons/website/static/tests/tours/carousel_content_removal.js b/addons/website/static/tests/tours/carousel_content_removal.js new file mode 100644 index 00000000000..1c7d3cff8a0 --- /dev/null +++ b/addons/website/static/tests/tours/carousel_content_removal.js @@ -0,0 +1,27 @@ +/** @odoo-module */ + +import tour from 'web_tour.tour'; + +tour.register("carousel_content_removal", { + url: "/", +}, [{ + trigger: "a[data-action=edit]", + content: "Click the Edit button.", + extra_trigger: ".homepage", +}, { + trigger: "#snippet_structure .oe_snippet:has(span:contains('Carousel')) .oe_snippet_thumbnail", + content: "Drag the Carousel block and drop it in your page.", + run: "drag_and_drop #wrap", +}, +{ + trigger: ".carousel .carousel-item.active .carousel-content", + content: "Select the active carousel item.", +}, { + trigger: ".oe_overlay.oe_active .oe_snippet_remove", + content: "Remove the active carousel item.", +}, +{ + trigger: ".carousel .carousel-item.active .container:not(:has(*))", + content: "Check for a carousel slide with an empty container tag", + run: function () {}, +}]); diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index ab5ad731e23..9d9f192d42f 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -272,3 +272,6 @@ class TestUi(odoo.tests.HttpCase): }]) self.start_tour("/?enable_editor=1", "focus_blur_snippets", login="admin") + + def test_14_carousel_snippet_content_removal(self): + self.start_tour("/", "carousel_content_removal", login='admin') diff --git a/addons/website/views/snippets/s_carousel.xml b/addons/website/views/snippets/s_carousel.xml index cc30313c4c8..be65e01c7f0 100644 --- a/addons/website/views/snippets/s_carousel.xml +++ b/addons/website/views/snippets/s_carousel.xml @@ -15,7 +15,7 @@