| 1 |
import { insertSnippet, registerWebsitePreviewTour } from '@website/js/tours/tour_utils'; |
| 2 |
|
| 3 |
/** |
| 4 |
* The purpose of this tour is to check the link on image flow. |
| 5 |
*/ |
| 6 |
|
| 7 |
const selectImageSteps = [{ |
| 8 |
content: "select block", |
| 9 |
trigger: ":iframe #wrapwrap .s_text_image", |
| 10 |
async run(helpers) { |
| 11 |
await helpers.click(); |
| 12 |
const el = this.anchor; |
| 13 |
const sel = el.ownerDocument.getSelection(); |
| 14 |
sel.collapse(el, 0); |
| 15 |
el.focus(); |
| 16 |
}, |
| 17 |
}, { |
| 18 |
content: "check link popover disappeared", |
| 19 |
trigger: ":iframe body:not(:has(.o_edit_menu_popover))", |
| 20 |
}, { |
| 21 |
content: "select image", |
| 22 |
trigger: ":iframe #wrapwrap .s_text_image img", |
| 23 |
run: "click", |
| 24 |
}]; |
| 25 |
|
| 26 |
registerWebsitePreviewTour('test_image_link', { |
| 27 |
url: '/', |
| 28 |
edition: true, |
| 29 |
}, () => [ |
| 30 |
...insertSnippet({ |
| 31 |
id: 's_text_image', |
| 32 |
name: 'Text - Image', |
| 33 |
groupName: "Content", |
| 34 |
}), |
| 35 |
...selectImageSteps, |
| 36 |
{ |
| 37 |
content: "enable link", |
| 38 |
trigger: ".o_customize_tab [data-container-title='Image'] button[data-action-id='setLink']", |
| 39 |
run: "click", |
| 40 |
}, { |
| 41 |
content: "enter site URL", |
| 42 |
trigger: ".o_customize_tab [data-container-title='Image'] div[data-action-id='setUrl'] input", |
| 43 |
run: "edit odoo.com && click body", |
| 44 |
}, |
| 45 |
...selectImageSteps, |
| 46 |
{ |
| 47 |
content: "check popover content has site URL", |
| 48 |
trigger: ".o-we-linkpopover a.o_we_url_link[href='http://odoo.com']:contains(http://odoo.com)", |
| 49 |
}, { |
| 50 |
content: "remove URL", |
| 51 |
trigger: ".o_customize_tab [data-container-title='Image'] div[data-action-id='setUrl'] input", |
| 52 |
run: "clear && click body", |
| 53 |
}, |
| 54 |
...selectImageSteps, |
| 55 |
{ |
| 56 |
content: "check popover content has no URL", |
| 57 |
trigger: ".o-we-linkpopover .o_we_href_input_link:value()", |
| 58 |
}, { |
| 59 |
content: "enter email URL", |
| 60 |
trigger: ".o_customize_tab [data-container-title='Image'] div[data-action-id='setUrl'] input", |
| 61 |
run: "edit mailto:[email protected] && click body", |
| 62 |
}, |
| 63 |
...selectImageSteps, |
| 64 |
{ |
| 65 |
content: "check popover content has mail URL", |
| 66 |
trigger: ".o-we-linkpopover:has(.fa-envelope-o) a.o_we_url_link[href='mailto:[email protected]']:contains(mailto:[email protected])", |
| 67 |
}, { |
| 68 |
content: "enter phone URL", |
| 69 |
trigger: ".o_customize_tab [data-container-title='Image'] div[data-action-id='setUrl'] input", |
| 70 |
run: "edit tel:555-2368 && click body", |
| 71 |
}, |
| 72 |
...selectImageSteps, |
| 73 |
{ |
| 74 |
content: "check popover content has phone URL", |
| 75 |
trigger: ".o-we-linkpopover:has(.fa-phone) a.o_we_url_link[href='tel:555-2368']:contains(tel:555-2368)", |
| 76 |
}, { |
| 77 |
content: "remove URL", |
| 78 |
trigger: ".o_customize_tab [data-container-title='Image'] div[data-action-id='setUrl'] input", |
| 79 |
run: "clear && click body", |
| 80 |
}, |
| 81 |
...selectImageSteps, |
| 82 |
{ |
| 83 |
content: "check popover content has no URL", |
| 84 |
trigger: ".o-we-linkpopover .o_we_href_input_link:value()", |
| 85 |
}, |
| 86 |
]); |