diff options
| author | Samuel Degueldre <sad@odoo.com> | 2021-01-22 10:12:21 +0000 |
|---|---|---|
| committer | Samuel Degueldre <sad@odoo.com> | 2021-02-04 11:29:46 +0000 |
| commit | 61f410b57f1c28bd6464b86d1582c22b7fd846d5 (patch) | |
| tree | 7773749a9a82228b45a0949771530a524f71d556 /addons/website/static | |
| parent | 80f05addf48dd57da9ae78f39116a9b23f60529a (diff) | |
[FIX] website, web_editor: fix empty parallax snippet not being removed
Previously, when removing all the content of a snippet, that snippet
would get automatically deleted. This was not the case for parallax
snippets because we previously intended the user to drop the parallax
snippet, empty it, and drop other content inside of it.
Recently, we added the parallax option on all snippets, rendering the
previous workflow obsolete. There is now no longer any reason to keep
empty parallax snippets. This commit fixes that.
task-2446008
closes odoo/odoo#64907
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static')
| -rw-r--r-- | addons/website/static/src/js/editor/snippets.editor.js | 8 | ||||
| -rw-r--r-- | addons/website/static/tests/tours/snippet_empty_parent_autoremove.js | 75 |
2 files changed, 83 insertions, 0 deletions
diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index 40f999f836c..c5d64e11d54 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -187,4 +187,12 @@ weSnippetEditor.Class.include({ }); }, }); + +weSnippetEditor.Editor.include({ + layoutElementsSelector: [ + weSnippetEditor.Editor.prototype.layoutElementsSelector, + '.s_parallax_bg', + '.o_bg_video_container', + ].join(','), +}); }); diff --git a/addons/website/static/tests/tours/snippet_empty_parent_autoremove.js b/addons/website/static/tests/tours/snippet_empty_parent_autoremove.js new file mode 100644 index 00000000000..719d112f81a --- /dev/null +++ b/addons/website/static/tests/tours/snippet_empty_parent_autoremove.js @@ -0,0 +1,75 @@ +odoo.define("website.tour.snippet_empty_parent_autoremove", function (require) { +"use strict"; + +const tour = require('web_tour.tour'); +const wTourUtils = require('website.tour_utils'); + +function removeSelectedBlock() { + return { + content: "Remove selected block", + trigger: '#oe_snippets we-customizeblock-options:last-child .oe_snippet_remove', + }; +} + +tour.register('snippet_empty_parent_autoremove', { + test: true, + url: '/?enable_editor=1', +}, [ + // Base case: remove both columns from text - image + wTourUtils.dragNDrop({ + id: 's_text_image', + name: 'Text - Image', + }), + { + content: "Click on second column", + trigger: '#wrap .s_text_image .row > :nth-child(2)', + }, + removeSelectedBlock(), + { + content: "Click on first column", + trigger: '#wrap .s_text_image .row > :first-child', + }, + removeSelectedBlock(), + { + content: "Check that #wrap is empty", + trigger: '#wrap:empty', + }, + + // Banner: test that parallax, bg-filter and shape are not treated as content + wTourUtils.dragNDrop({ + id: 's_banner', + name: 'Banner', + }), + wTourUtils.clickOnSnippet({ + id: 's_banner', + name: 'Banner', + }), + { + content: "Check that parallax is present", + trigger: '#wrap .s_banner .s_parallax_bg', + run: () => null, + }, + wTourUtils.changeOption('ColoredLevelBackground', 'Shape'), + { + content: "Check that shape is present", + trigger: '#wrap .s_banner .o_we_shape', + run: () => null, + }, + wTourUtils.changeOption('ColoredLevelBackground', 'Filter'), + { + content: "Check that background-filter is present", + trigger: '#wrap .s_banner .o_we_bg_filter', + run: () => null, + }, + { + content: "Click on first column", + trigger: '#wrap .s_banner .row > :first-child', + }, + removeSelectedBlock(), + { + content: "Check that #wrap is empty", + trigger: '#wrap:empty', + run: () => null, + }, +]); +}); |
