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 997ba0d11a7..3ac46c358b7 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1440,6 +1440,8 @@ var SnippetsMenu = Widget.extend({ const target = selection.getRangeAt(0).startContainer.parentElement; this._activateSnippet($(target)); } + + this._updateInvisibleDOM(); }, 500); this.options.wysiwyg.odooEditor.addEventListener('historyUndo', refreshSnippetEditors); this.options.wysiwyg.odooEditor.addEventListener('historyRedo', refreshSnippetEditors); diff --git a/addons/website/static/tests/tours/snippet_popup_add_remove.js b/addons/website/static/tests/tours/snippet_popup_add_remove.js index f8194f30e95..e0d86271b9f 100644 --- a/addons/website/static/tests/tours/snippet_popup_add_remove.js +++ b/addons/website/static/tests/tours/snippet_popup_add_remove.js @@ -28,4 +28,28 @@ wTourUtils.registerEditionTour('snippet_popup_add_remove', { in_modal: false, trigger: 'iframe #wrap.o_editable:not(:has([data-snippet="s_popup"]))', run: () => null, +}, +// Test that undoing dropping the snippet removes the invisible elements panel. +{ + content: "Drop the snippet again.", + trigger: '#oe_snippets .oe_snippet:has(> [data-snippet="s_popup"]) .oe_snippet_thumbnail', + run: "drag_and_drop iframe #wrap", +}, { + content: "The popup should be in the invisible elements panel.", + in_modal: false, + trigger: '.o_we_invisible_el_panel .o_we_invisible_entry', + run: () => null, // It's a check. +}, { + content: "Click on the 'undo' button.", + in_modal: false, + trigger: '#oe_snippets button[data-action="undo"]', +}, { + content: "Check that the s_popup was removed.", + in_modal: false, + trigger: 'iframe #wrap.o_editable:not(:has([data-snippet="s_popup"]))', + run: () => null, // It's a check. +}, { + content: "The invisible elements panel should also be removed.", + trigger: '#oe_snippets:has(.o_we_invisible_el_panel.d-none)', + run: () => null, // It's a check. }]);