1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/** @odoo-module **/
import {
insertSnippet,
goBackToBlocks,
goToTheme,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
const WEBSITE_MAIN_COLOR = '#ABCDEF';
registerWebsitePreviewTour('website_text_edition', {
url: '/',
edition: true,
}, () => [
...goToTheme(),
{
content: "Open colorpicker to change website main color",
trigger: 'we-select[data-color="o-color-1"] .o_we_color_preview',
run: "click",
},
{
content: "Input the value for the new website main color (also make sure it is independent from the backend)",
trigger: '.o_hex_input',
run: `edit ${WEBSITE_MAIN_COLOR} && click body`,
},
goBackToBlocks(),
...insertSnippet({id: "s_text_block", name: "Text", groupName: "Text"}),
{
content: "Click on the text block first paragraph (to auto select)",
trigger: ':iframe .s_text_block p',
run: "click",
},
{
content: "Open the foreground colorpicker",
trigger: '#toolbar:not(.oe-floating) #oe-text-color',
run: "click",
},
{
content: "Go to the 'solid' tab",
trigger: '.o_we_colorpicker_switch_pane_btn[data-target="custom-colors"]',
run: "click",
},
{
content: "Input the website main color explicitly",
trigger: '.o_hex_input',
run: `edit ${WEBSITE_MAIN_COLOR} && click body`,
},
{
content: "Check that paragraph now uses the main color *class*",
trigger: ':iframe .s_text_block p',
run: function (actions) {
const fontEl = this.anchor.querySelector("font");
if (!fontEl) {
console.error("A background color should have been applied");
return;
}
if (fontEl.style.backgroundColor) {
console.error("The paragraph should not have an inline style background color");
return;
}
if (!fontEl.classList.contains('text-o-color-1')) {
console.error("The paragraph should have the right background color class");
return;
}
},
}
]);
|