From 80eb0afecd6e5569bdb3b4a33cf4fd46d65ee1a6 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Fri, 28 Aug 2020 10:09:05 +0200 Subject: [PATCH] [FIX] mass_mailing_custom_unsubscribe: Added the changes to avoid the linter warnings --- .../static/src/js/contact.tour.js | 177 +++++++++--------- .../static/src/js/partner.tour.js | 79 ++++---- 2 files changed, 134 insertions(+), 122 deletions(-) diff --git a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js index 0860b82f2..0d12240dc 100644 --- a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js +++ b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js @@ -1,93 +1,102 @@ /* Copyright 2016 Jairo Llopis * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ odoo.define("mass_mailing_custom_unsubscribe.contact_tour", - function (require) { - "use strict"; - var base = require("web_editor.base"); - var tour = require("web_tour.tour"); + function (require) { + "use strict"; + var base = require("web_editor.base"); + var tour = require("web_tour.tour"); - // Allow to know if an element is required - $.extend($.expr[':'], { - propRequired: function(element, index, matches) { - return $(element).prop("required"); - }, - }); + // Allow to know if an element is required + $.extend($.expr[':'], { + propRequired: function (element) { + return $(element).prop("required"); + }, + }); - tour.register( - "mass_mailing_custom_unsubscribe_tour_contact", - { - test: true, - wait_for: base.ready(), - }, - [ + tour.register( + "mass_mailing_custom_unsubscribe_tour_contact", { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio:not(:checked)", - extra_trigger: "#reason_form #custom_div_feedback", + test: true, + wait_for: base.ready(), }, - { - content: "Switch to not interested reason", - trigger: ".radio:contains(\"I'm not interested\") :radio:not(:checked)", - extra_trigger: "[name='details']:propRequired", - }, - { - content: "Unsubscribe", - trigger: "#reason_form button:submit", - extra_trigger: "body:not(:has([name='details']:propRequired))", - }, - { - content: "Successfully unsubscribed", - trigger: "body:not(:has(#reason_form)) #subscription_info " + + [ + { + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio:not(:checked)", + extra_trigger: "#reason_form #custom_div_feedback", + }, + { + content: "Switch to not interested reason", + trigger: + ".radio:contains(\"I'm not interested\") :radio:not(:checked)", + extra_trigger: "[name='details']:propRequired", + }, + { + content: "Unsubscribe", + trigger: "#reason_form button:submit", + extra_trigger: "body:not(:has([name='details']:propRequired))", + }, + { + content: "Successfully unsubscribed", + trigger: "body:not(:has(#reason_form)) #subscription_info " + ":contains('successfully unsubscribed from')", - }, - { - content: "Unsubscription reasons are invisible", - trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", - }, - { - content: "List 2 is not cross unsubscriptable", - trigger: "body:not(:has(li:contains('test list 2')))", - }, - { - content: "List 3 is not public", - trigger: "body:not(:has(li:contains('test list 3')))", - }, - { - content: "Uncheck list 1", - trigger: "li:contains('test list 1') input:checked", - }, - { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio", - extra_trigger: ".radio:contains('Other reason') " + + }, + { + content: "Unsubscription reasons are invisible", + trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", + }, + { + content: "List 2 is not cross unsubscriptable", + trigger: "body:not(:has(li:contains('test list 2')))", + }, + { + content: "List 3 is not public", + trigger: "body:not(:has(li:contains('test list 3')))", + }, + { + content: "Uncheck list 1", + trigger: "li:contains('test list 1') input:checked", + }, + { + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio", + extra_trigger: ".radio:contains('Other reason') " + ":radio:not(:checked)", - }, - { - content: "Add details to reason", - trigger: "[name='details']:visible:propRequired", - run: "text I want to unsubscribe because I want. Period.", - extra_trigger: ".radio:contains('Other reason') :radio:checked", - }, - { - content: "Update subscriptions 2nd time", - trigger: "#unsubscribe_form :submit", - }, - { - content: "Successfully unsubscribed", - trigger: "#subscription_info:contains('Your changes have been saved.')", - }, - { - content: "Subscribe again to list 0", - trigger: "body:not(:has(#unsubscribe_form #custom_div_feedback:visible)):has(.alert-success) li:contains('test list 0') input:not(:checked)", - }, - { - content: "Update subscriptions 3nd time", - trigger: "#unsubscribe_form:not(:has(.js_unsubscription_reason:visible)) :submit", - }, - { - content: "Successfully subscribed", - trigger: "#subscription_info:contains('Your changes have been saved.')", - }, - ] - ); -}); + }, + { + content: "Add details to reason", + trigger: "[name='details']:visible:propRequired", + run: "text I want to unsubscribe because I want. Period.", + extra_trigger: ".radio:contains('Other reason') :radio:checked", + }, + { + content: "Update subscriptions 2nd time", + trigger: "#unsubscribe_form :submit", + }, + { + content: "Successfully unsubscribed", + trigger: + "#subscription_info:contains('Your changes have been saved.')", + }, + { + content: "Subscribe again to list 0", + // eslint-disable-next-line no-multi-str + trigger:"body:not(:has(#unsubscribe_form #custom_div_feedback\ + :visible)):has(.alert-success) li:contains('test list 0') \ + input:not(:checked)", + }, + { + content: "Update subscriptions 3nd time", + // eslint-disable-next-line no-multi-str + trigger:"#unsubscribe_form:not(\ + :has(.js_unsubscription_reason:visible)) :submit", + }, + { + content: "Successfully subscribed", + trigger: + "#subscription_info:contains('Your changes have been saved.')", + }, + ] + ); + } +); diff --git a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js index d7e701d6a..063cbee61 100644 --- a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js +++ b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js @@ -1,45 +1,48 @@ /* Copyright 2016 Jairo Llopis * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ odoo.define("mass_mailing_custom_unsubscribe.partner_tour", - function (require) { - "use strict"; - var base = require("web_editor.base"); - var tour = require("web_tour.tour"); + function (require) { + "use strict"; + var base = require("web_editor.base"); + var tour = require("web_tour.tour"); - // Allow to know if an element is required - $.extend($.expr[':'], { - propRequired: function(element, index, matches) { - return $(element).prop("required"); - }, - }); + // Allow to know if an element is required + $.extend($.expr[':'], { + propRequired: function (element) { + return $(element).prop("required"); + }, + }); - tour.register( - "mass_mailing_custom_unsubscribe_tour_partner", - { - tour: true, - wait_for: base.ready(), - }, - [ + tour.register( + "mass_mailing_custom_unsubscribe_tour_partner", { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio:not(:checked)", - extra_trigger: "#reason_form #custom_div_feedback", + tour: true, + wait_for: base.ready(), }, - { - content: "Switch to not interested reason", - trigger: ".radio:contains(\"I'm not interested\") :radio:not(:checked)", - extra_trigger: "[name='details']:propRequired", - }, - { - content: "Unsubscribe", - trigger: "#reason_form button:submit", - extra_trigger: "body:not(:has([name='details']:propRequired))", - }, - { - content: "Successfully unsubscribed", - trigger: "body:not(:has(#reason_form)) #subscription_info " + - ":contains('successfully unsubscribed')", - }, - ] - ); -}); + [ + { + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio:not(:checked)", + extra_trigger: "#reason_form #custom_div_feedback", + }, + { + content: "Switch to not interested reason", + // eslint-disable-next-line no-multi-str + trigger: ".radio:contains(\"I'm not interested\") \ + :radio:not(:checked)", + extra_trigger: "[name='details']:propRequired", + }, + { + content: "Unsubscribe", + trigger: "#reason_form button:submit", + extra_trigger: "body:not(:has([name='details']:propRequired))", + }, + { + content: "Successfully unsubscribed", + trigger: "body:not(:has(#reason_form)) #subscription_info " + + ":contains('successfully unsubscribed')", + }, + ] + ); + } +);