From fc83af4b0b209ffc0ae3d117fd9865b68aa2f118 Mon Sep 17 00:00:00 2001 From: xO-Tx Date: Wed, 13 Jan 2021 16:08:21 +0000 Subject: [FIX] website_form, *: allow to update buttons using link dialog *: web_editor, website_mass_mailing When we double click a link/button, a link dialog appears to update the target properties, and since the current link dialog can only handle anchor targets, using it on buttons leads to some inconsistencies : - visible href options for button & url required to save changes. - missing preview when button style changed. ... The goal of this commit is to add a fix (with minimum of code) on summernote linkdialog to handle button elements using the same logic as anchor nodes. Also, update website form test tour to test those new changes. Part of https://github.com/odoo/odoo/pull/62206 task-2381305 --- .../static/tests/tours/website_form_editor.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'addons/website_form/static') diff --git a/addons/website_form/static/tests/tours/website_form_editor.js b/addons/website_form/static/tests/tours/website_form_editor.js index a50afdf1e7b..97708dccc52 100644 --- a/addons/website_form/static/tests/tours/website_form_editor.js +++ b/addons/website_form/static/tests/tours/website_form_editor.js @@ -226,6 +226,39 @@ odoo.define('website_form_editor.tour', function (require) { ...addExistingField('attachment_ids', 'file', 'Invoice Scan'), + // Edit the submit button using linkDialog. + { + content: "Double click submit button to edit it", + trigger: '.s_website_form_send', + run: 'dblclick', + }, { + content: "Check that no URL field is suggested", + trigger: 'form:has(#o_link_dialog_label_input:hidden)', + run: () => null, + }, { + content: "Check that preview element has the same style", + trigger: '.o_link_dialog_preview:has(.s_website_form_send.btn.btn-lg.btn-primary)', + run: () => null, + }, { + content: "Change button's style", + trigger: 'label:has(input[name="link_style_color"][value="secondary"])', + run: () => { + $('input[name="link_style_color"][value="secondary"]').click(); + $('select[name="link_style_shape"]').val('rounded-circle').change(); + $('select[name="link_style_size"]').val('sm').change(); + }, + }, { + content: "Check that preview is updated too", + trigger: '.o_link_dialog_preview:has(.s_website_form_send.btn.btn-sm.btn-secondary.rounded-circle)', + run: () => null, + }, { + content: "Save changes from linkDialog", + trigger: '.modal-footer .btn-primary', + }, { + content: "Check the resulting button", + trigger: '.s_website_form_send.btn.btn-sm.btn-secondary.rounded-circle', + run: () => null, + }, // Save the page { trigger: 'body', -- cgit v1.2.3