|
|
@ -3,75 +3,72 @@ |
|
|
|
odoo.define("mass_mailing_custom_unsubscribe.contact_tour", |
|
|
|
function (require) { |
|
|
|
"use strict"; |
|
|
|
var Tour = require("web.Tour"); |
|
|
|
var base = require("web_editor.base"); |
|
|
|
var tour = require("web_tour.tour"); |
|
|
|
require("mass_mailing_custom_unsubscribe.require_details"); |
|
|
|
require("mass_mailing_custom_unsubscribe.unsubscribe"); |
|
|
|
|
|
|
|
// Allow to know if an element is required
|
|
|
|
$.extend($.expr[':'], { |
|
|
|
propRequired: function(element, index, matches) { |
|
|
|
propRequired: function(element, index, matches) { |
|
|
|
return $(element).prop("required"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
Tour.register({ |
|
|
|
id: "mass_mailing_custom_unsubscribe_tour_contact", |
|
|
|
name: "Mass mailing contact unsubscribes", |
|
|
|
mode: "test", |
|
|
|
steps: [ |
|
|
|
tour.register( |
|
|
|
"mass_mailing_custom_unsubscribe_tour_contact", |
|
|
|
{ |
|
|
|
tour: true, |
|
|
|
wait_for: base.ready(), |
|
|
|
}, |
|
|
|
[ |
|
|
|
{ |
|
|
|
title: "Unsubscription reasons are invisible", |
|
|
|
waitFor: "#unsubscribe_form .js_unsubscription_reason:hidden", |
|
|
|
content: "Unsubscription reasons are invisible", |
|
|
|
trigger: "#unsubscribe_form:has(.js_unsubscription_reason:hidden)", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Uncheck list 0", |
|
|
|
element: "li:contains('test list 0') input", |
|
|
|
waitFor: "li:contains('test list 0') input:checked", |
|
|
|
content: "Uncheck list 0", |
|
|
|
trigger: "li:contains('test list 0') input", |
|
|
|
// List 2 is not cross unsubscriptable
|
|
|
|
waitNot: "li:contains('test list 2')", |
|
|
|
extra_trigger: "body:not(:has(li:contains('test list 2'))) li:contains('test list 0') input:checked", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Uncheck list 1", |
|
|
|
element: "li:contains('test list 1') input:checked", |
|
|
|
waitFor: ".js_unsubscription_reason:visible", |
|
|
|
content: "Uncheck list 1", |
|
|
|
trigger: "li:contains('test list 1') input:checked", |
|
|
|
extra_trigger: ".js_unsubscription_reason:visible", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Choose other reason", |
|
|
|
element: ".radio:contains('Other reason') :radio", |
|
|
|
waitFor: ".radio:contains('Other reason') " + |
|
|
|
":radio:not(:checked)", |
|
|
|
content: "Choose other reason", |
|
|
|
trigger: ".radio:contains('Other reason') :radio", |
|
|
|
extra_trigger: ".radio:contains('Other reason') " + |
|
|
|
":radio:not(:checked)", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Add details to reason", |
|
|
|
element: "[name='details']:visible:propRequired", |
|
|
|
sampleText: "I want to unsubscribe because I want. Period.", |
|
|
|
waitFor: ".radio:contains('Other reason') :radio: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", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Update subscriptions 1st time", |
|
|
|
element: "#unsubscribe_form :submit", |
|
|
|
content: "Update subscriptions 1st time", |
|
|
|
trigger: "#unsubscribe_form :submit", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Subscribe again to list 0", |
|
|
|
element: "li:contains('test list 0') input:not(:checked)", |
|
|
|
waitFor: ".alert-success", |
|
|
|
waitNot: "#unsubscribe_form .js_unsubscription_reason:visible", |
|
|
|
onend: function () { |
|
|
|
content: "Subscribe again to list 0", |
|
|
|
trigger: "body:not(:has(#unsubscribe_form .js_unsubscription_reason:visible)):has(.alert-success, li:contains('test list 0') input:not(:checked))", |
|
|
|
run: function () { |
|
|
|
// This one will get the success again after next step
|
|
|
|
$(".alert-success").removeClass("alert-success"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Update subscriptions 2nd time", |
|
|
|
element: "#unsubscribe_form :submit", |
|
|
|
waitNot: "#unsubscribe_form .js_unsubscription_reason:visible", |
|
|
|
content: "Update subscriptions 2nd time", |
|
|
|
trigger: "#unsubscribe_form:not(:has(.js_unsubscription_reason:visible)) :submit", |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "Resuscription was OK", |
|
|
|
waitFor: ".alert-success", |
|
|
|
content: "Resuscription was OK", |
|
|
|
trigger: ".alert-success", |
|
|
|
} |
|
|
|
] |
|
|
|
}); |
|
|
|
|
|
|
|
return Tour.tours.mass_mailing_custom_unsubscribe_tour_contact; |
|
|
|
); |
|
|
|
}); |