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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
/** @odoo-module */
import {
changeOption,
clickOnSave,
insertSnippet,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
registerWebsitePreviewTour("website_media_dialog_undraw", {
url: '/',
edition: true,
}, () => [
...insertSnippet({
id: 's_text_image',
name: 'Text - Image',
groupName: "Content",
}),
{
content: "Open the media dialog from the snippet",
trigger: ":iframe .s_text_image img",
run: "dblclick",
}, {
content: "Search for 'banner' to call the media library", // Mocked call
trigger: ".o_select_media_dialog .o_we_search",
run: "edit banner",
}, {
content: "Check that the media library is available",
trigger: '.o_select_media_dialog:has(.o_we_search_select option[value="media-library"])',
},
]);
registerWebsitePreviewTour("website_media_dialog_external_library", {
url: "/",
edition: true,
}, () => [
...insertSnippet({
id: "s_text_image",
name: "Text - Image",
groupName: "Content",
}),
{
content: "Open the media dialog from the snippet",
trigger: ":iframe .s_text_image img",
run: "dblclick",
}, {
content: "Dummy search to call the media library",
trigger: ".o_select_media_dialog .o_we_search",
run: "edit a",
}, {
content: "Choose the media library to only show its media",
trigger: ".o_select_media_dialog .o_we_search_select",
run: "select Illustrations",
}, {
content: "Double click on the first image",
trigger: ".o_select_media_dialog img.o_we_attachment_highlight",
run: "click",
}, {
content: "Reopen the media dialog",
trigger: ":iframe .s_text_image img",
run: "dblclick",
}, {
content: "Check that the image was created only once",
trigger: ".o_select_media_dialog .o_we_existing_attachments .o_existing_attachment_cell img[src^='/html_editor/shape/illustration/']",
run() {
const listEl = this.anchor.closest(".o_select_media_dialog .o_we_existing_attachments");
const selector = ".o_existing_attachment_cell img[src^='/html_editor/shape/illustration/']";
const uploadedImgs = listEl.querySelectorAll(`${selector}[title='${this.anchor.title}']`);
if (uploadedImgs.length !== 1) {
throw new Error(`${uploadedImgs.length} attachment(s) were found. Exactly 1 should have been created.`);
}
},
},
]);
registerWebsitePreviewTour('website_media_dialog_icons', {
url: '/',
edition: true,
}, () => [
...insertSnippet({
id: 's_social_media',
name: 'Social Media',
}),
{
content: "Open MediaDialog from a snippet icon",
trigger: ':iframe .s_social_media .fa-instagram',
run: "dblclick",
},
{
content: "Pick the same icon",
trigger: '.o_select_media_dialog .o_we_attachment_selected.fa-instagram',
run: "click",
},
{
content: "Check if the icon remains the same",
trigger: ':iframe .s_social_media .fa-instagram',
},
{
content: "Open MediaDialog again",
trigger: ':iframe .s_social_media .fa-instagram',
run: "dblclick",
},
{
content: "Click on the ADD button",
trigger: '.o_select_media_dialog .btn:contains(Add)',
run: "click",
},
{
content: "Check if the icon remains the same",
trigger: ':iframe .s_social_media .fa-instagram',
},
...clickOnSave()
]);
registerWebsitePreviewTour("website_media_dialog_image_shape", {
url: "/",
edition: true,
}, () => [
...insertSnippet({
id: "s_text_image",
name: "Text - Image",
groupName: "Content",
}),
{
content: "Click on the image",
trigger: ":iframe .s_text_image img",
run: "click",
},
changeOption("ImageTools", 'we-select[data-name="shape_img_opt"] we-toggler'),
changeOption("ImageTools", "we-button[data-set-img-shape]"),
{
content: "Open MediaDialog from an image",
trigger: ":iframe .s_text_image img[data-shape]",
run: "dblclick",
},
{
content: "Click on the 'Icons' tab",
trigger: '.o_select_media_dialog .o_notebook_headers .nav-item a:contains("Icons")',
run: "click",
},
{
content: "Select an icon",
trigger: ".o_select_media_dialog:has(.nav-link.active:contains('Icons')) .tab-content span.fa-heart",
run: "click",
},
{
content: "Checks that the icon doesn't have a shape",
trigger: ":iframe .s_text_image .fa-heart:not([data-shape])",
},
]);
|