Files
odoo_source/addons/website/static/tests/tours/website_page_options.js
T
Benjamin Vray 9fe6d82deb [FIX] website: fix "over the content" option not saved
Since this commit [1], when you select the Header position option and
set it to "Over The Content", the change is not saved if you did not
edit something else in the page too.

Indeed, now that the "save" works correctly (and that it no longer saves
the page every time). It does not detect the change made by this option
which is to add a class on the '#wrapwrap' element. (The editor looks
for changes inside the wrapwrap but not on it).

This commit checks if any page option is dirty on save on top of
checking if the content of the page has been modified.

Additionally, this commit fixes a bug that would occur on Firefox based
browsers where the hidden input used to display the status of these
options would be auto-completed by the browser in some conditions.
(https://bugzilla.mozilla.org/show_bug.cgi?id=520561).
This could result in an incorrect state being displayed.
To reproduce:
  - Change the option, click on cancel, start the editor
  - the incorrect state is displayed

A test is also added by this commit to verify that all the page options
works correctly.

[1]: https://github.com/odoo/odoo/commit/bab673488e185ddd7792aedecc3870663290fed3

task-2871426

X-original-commit: ea7a69b344d970cc2b31555f4cd8fd7c5e2fc6d2
Part-of: odoo/odoo#94949
2022-07-27 02:18:05 +02:00

58 lines
2.5 KiB
JavaScript

/** @odoo-module **/
import wTourUtils from 'website.tour_utils';
wTourUtils.registerEditionTour('website_page_options', {
test: true,
url: '/',
edition: true,
}, [
wTourUtils.clickOnSnippet({id: 'o_header_standard', name: 'Header'}),
wTourUtils.changeOption('TopMenuVisibility', 'we-select:has([data-visibility]) we-toggler'),
wTourUtils.changeOption('TopMenuVisibility', 'we-button[data-visibility="transparent"]'),
// It's important to test saving right after changing that option only as
// this is why this test was made in the first place: the page was not
// marked as dirty when that option was the only one that was changed.
...wTourUtils.clickOnSave(),
{
content: "Check that the header is transparent",
trigger: 'iframe #wrapwrap.o_header_overlay',
run: () => null, // it's a check
},
wTourUtils.clickOnEdit(),
wTourUtils.clickOnSnippet({id: 'o_header_standard', name: 'Header'}),
wTourUtils.changeOption('topMenuColor', 'we-select.o_we_so_color_palette'),
wTourUtils.changeOption('topMenuColor', 'button[data-color="black-50"]', 'background color', 'bottom', true),
...wTourUtils.clickOnSave(),
{
content: "Check that the header is in black-50",
trigger: 'iframe header#top.bg-black-50',
run: () => null, // it's a check
},
wTourUtils.clickOnEdit(),
wTourUtils.clickOnSnippet({id: 'o_header_standard', name: 'Header'}),
wTourUtils.changeOption('TopMenuVisibility', 'we-select:has([data-visibility]) we-toggler'),
wTourUtils.changeOption('TopMenuVisibility', 'we-button[data-visibility="hidden"]'),
...wTourUtils.clickOnSave(),
{
content: "Check that the header is hidden",
trigger: 'iframe #wrapwrap:has(header#top.d-none.o_snippet_invisible)',
run: () => null, // it's a check
},
wTourUtils.clickOnEdit(),
{
content: "Click on 'header' in the invisible elements list",
extra_trigger: '#oe_snippets.o_loaded',
trigger: '.o_we_invisible_el_panel .o_we_invisible_entry',
},
wTourUtils.clickOnSnippet({id: 'o_footer', name: 'Footer'}),
wTourUtils.changeOption('HideFooter', 'we-button[data-name="hide_footer_page_opt"] we-checkbox'),
...wTourUtils.clickOnSave(),
{
content: "Check that the footer is hidden and the header is visible",
trigger: 'iframe #wrapwrap:has(.o_footer.d-none.o_snippet_invisible)',
extra_trigger: 'iframe #wrapwrap header#top:not(.d-none)',
run: () => null, // it's a check
},
]);