Skip to content
Snippets Groups Projects
Commit c23f0d5a authored by Tom De Caluwé's avatar Tom De Caluwé Committed by qsm-odoo
Browse files

[FIX] website: never hide countdowns with redirect action in edit mode


When editing a countdown with a redirect action, sometimes the
countdown block will be hidden when toggling the "Hide countdown at the
end" option.

The problem is caused by the button that allows previewing
and editing the end message of the countdown, this button does not
apply in the case of a redirect action though. However, the button can
still be activated by selecting a different end action first and
switching to the redirect action afterwards, in which case it will
incorrectly hide the countdown.

task-2638366

closes odoo/odoo#76343

Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: default avatarqsm-odoo <qsm@odoo.com>
parent 09b88487
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,9 @@ options.registry.countdown = options.Class.extend({
}
} else {
const $message = this.$target.find('.s_countdown_end_message').detach();
if (this.showEndMessage) {
this._onToggleEndMessageClick();
}
if ($message.length) {
this.endMessage = $message[0].outerHTML;
}
......
......@@ -26,6 +26,43 @@ tour.register('snippet_countdown', {
{
content: "Check that the countdown message is still displayed",
trigger: '.s_countdown .s_picture',
run: () => {
// Just a visibility check
// Also make sure the mouseout and mouseleave are triggered so that
// next steps make sense.
// TODO the next steps are not actually testing anything without
// it and the mouseout and mouseleave make sense but really it
// should not be *necessary* to simulate those for the editor flow
// to make some sense.
const $previousAnchor = $('[data-select-class="hide-countdown"]');
$previousAnchor.trigger('mouseout');
$previousAnchor.trigger('mouseleave');
},
},
// Next, we change the end action to redirect while the edit message toggle
// is still activated. Now, we can check if the countdown cannot be hidden
// by mistake.
wTourUtils.changeOption('countdown', 'we-select:has([data-end-action]) we-toggler', 'end action'),
wTourUtils.changeOption('countdown', 'we-button[data-end-action="redirect"]', 'end action'),
{
content: "Click on the 'hide countdown at the end' button",
trigger: '[data-select-class="hide-countdown"] we-checkbox',
run: function (actions) {
actions.auto();
// Needed since the bug this test is covering occured after a small
// delay.
// TODO should really be more robust
setTimeout(() => {
document.body.classList.add('o_countdown_tour_small_delay');
}, 100);
},
},
{
content: "Check that the countdown is still displayed",
trigger: '.s_countdown_canvas_wrapper',
extra_trigger: '.o_countdown_tour_small_delay',
run: () => null, // Just a visibility check
},
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment