[FIX] mass_mailing_custom_unsubscribe: Added the changes to avoid the linter warnings

pull/599/head
Carlos Roca 2020-08-28 10:09:05 +02:00
parent 28db3c57d0
commit 80eb0afecd
2 changed files with 134 additions and 122 deletions

View File

@ -1,93 +1,102 @@
/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> /* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("mass_mailing_custom_unsubscribe.contact_tour", odoo.define("mass_mailing_custom_unsubscribe.contact_tour",
function (require) { function (require) {
"use strict"; "use strict";
var base = require("web_editor.base"); var base = require("web_editor.base");
var tour = require("web_tour.tour"); var tour = require("web_tour.tour");
// Allow to know if an element is required // Allow to know if an element is required
$.extend($.expr[':'], { $.extend($.expr[':'], {
propRequired: function(element, index, matches) { propRequired: function (element) {
return $(element).prop("required"); return $(element).prop("required");
}, },
}); });
tour.register( tour.register(
"mass_mailing_custom_unsubscribe_tour_contact", "mass_mailing_custom_unsubscribe_tour_contact",
{
test: true,
wait_for: base.ready(),
},
[
{ {
content: "Choose other reason", test: true,
trigger: ".radio:contains('Other reason') :radio:not(:checked)", wait_for: base.ready(),
extra_trigger: "#reason_form #custom_div_feedback",
}, },
{ [
content: "Switch to not interested reason", {
trigger: ".radio:contains(\"I'm not interested\") :radio:not(:checked)", content: "Choose other reason",
extra_trigger: "[name='details']:propRequired", trigger: ".radio:contains('Other reason') :radio:not(:checked)",
}, extra_trigger: "#reason_form #custom_div_feedback",
{ },
content: "Unsubscribe", {
trigger: "#reason_form button:submit", content: "Switch to not interested reason",
extra_trigger: "body:not(:has([name='details']:propRequired))", trigger:
}, ".radio:contains(\"I'm not interested\") :radio:not(:checked)",
{ extra_trigger: "[name='details']:propRequired",
content: "Successfully unsubscribed", },
trigger: "body:not(:has(#reason_form)) #subscription_info " + {
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')", ":contains('successfully unsubscribed from')",
}, },
{ {
content: "Unsubscription reasons are invisible", content: "Unsubscription reasons are invisible",
trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)",
}, },
{ {
content: "List 2 is not cross unsubscriptable", content: "List 2 is not cross unsubscriptable",
trigger: "body:not(:has(li:contains('test list 2')))", trigger: "body:not(:has(li:contains('test list 2')))",
}, },
{ {
content: "List 3 is not public", content: "List 3 is not public",
trigger: "body:not(:has(li:contains('test list 3')))", trigger: "body:not(:has(li:contains('test list 3')))",
}, },
{ {
content: "Uncheck list 1", content: "Uncheck list 1",
trigger: "li:contains('test list 1') input:checked", trigger: "li:contains('test list 1') input:checked",
}, },
{ {
content: "Choose other reason", content: "Choose other reason",
trigger: ".radio:contains('Other reason') :radio", trigger: ".radio:contains('Other reason') :radio",
extra_trigger: ".radio:contains('Other reason') " + extra_trigger: ".radio:contains('Other reason') " +
":radio:not(:checked)", ":radio:not(:checked)",
}, },
{ {
content: "Add details to reason", content: "Add details to reason",
trigger: "[name='details']:visible:propRequired", trigger: "[name='details']:visible:propRequired",
run: "text I want to unsubscribe because I want. Period.", run: "text I want to unsubscribe because I want. Period.",
extra_trigger: ".radio:contains('Other reason') :radio:checked", extra_trigger: ".radio:contains('Other reason') :radio:checked",
}, },
{ {
content: "Update subscriptions 2nd time", content: "Update subscriptions 2nd time",
trigger: "#unsubscribe_form :submit", trigger: "#unsubscribe_form :submit",
}, },
{ {
content: "Successfully unsubscribed", content: "Successfully unsubscribed",
trigger: "#subscription_info:contains('Your changes have been saved.')", 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: "Subscribe again to list 0",
}, // eslint-disable-next-line no-multi-str
{ trigger:"body:not(:has(#unsubscribe_form #custom_div_feedback\
content: "Update subscriptions 3nd time", :visible)):has(.alert-success) li:contains('test list 0') \
trigger: "#unsubscribe_form:not(:has(.js_unsubscription_reason:visible)) :submit", input:not(:checked)",
}, },
{ {
content: "Successfully subscribed", content: "Update subscriptions 3nd time",
trigger: "#subscription_info:contains('Your changes have been saved.')", // 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.')",
},
]
);
}
);

View File

@ -1,45 +1,48 @@
/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> /* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("mass_mailing_custom_unsubscribe.partner_tour", odoo.define("mass_mailing_custom_unsubscribe.partner_tour",
function (require) { function (require) {
"use strict"; "use strict";
var base = require("web_editor.base"); var base = require("web_editor.base");
var tour = require("web_tour.tour"); var tour = require("web_tour.tour");
// Allow to know if an element is required // Allow to know if an element is required
$.extend($.expr[':'], { $.extend($.expr[':'], {
propRequired: function(element, index, matches) { propRequired: function (element) {
return $(element).prop("required"); return $(element).prop("required");
}, },
}); });
tour.register( tour.register(
"mass_mailing_custom_unsubscribe_tour_partner", "mass_mailing_custom_unsubscribe_tour_partner",
{
tour: true,
wait_for: base.ready(),
},
[
{ {
content: "Choose other reason", tour: true,
trigger: ".radio:contains('Other reason') :radio:not(:checked)", wait_for: base.ready(),
extra_trigger: "#reason_form #custom_div_feedback",
}, },
{ [
content: "Switch to not interested reason", {
trigger: ".radio:contains(\"I'm not interested\") :radio:not(:checked)", content: "Choose other reason",
extra_trigger: "[name='details']:propRequired", trigger: ".radio:contains('Other reason') :radio:not(:checked)",
}, extra_trigger: "#reason_form #custom_div_feedback",
{ },
content: "Unsubscribe", {
trigger: "#reason_form button:submit", content: "Switch to not interested reason",
extra_trigger: "body:not(:has([name='details']:propRequired))", // eslint-disable-next-line no-multi-str
}, trigger: ".radio:contains(\"I'm not interested\") \
{ :radio:not(:checked)",
content: "Successfully unsubscribed", extra_trigger: "[name='details']:propRequired",
trigger: "body:not(:has(#reason_form)) #subscription_info " + },
":contains('successfully unsubscribed')", {
}, 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')",
},
]
);
}
);