[FIX] website: fix wrong selector creation in clickOnSnippet tour util
Since [1], there would be a traceback due to a wrong DOM selector in the `configurator_tour`. Indeed, completing the configurator will activate the configurator_tour asset which is calling a broken clickOnSnippet tour util to generate an appropriate homepage tour. It would end up with the following selector: `o_website_preview[data-view-xmlid='website.homepage'] iframe #wrapwrap .#wrap > section:nth-child(2)` See the `.#wrap` which is incorrect and make jQuery crash. This is because [1] adapted the tour utils to the new WebsitePreview client action, but the clickOnSnippet function was wrongly changed and could now be generating wrong triggers selector. It was creating invalid selectors as it was concatenating a `.` with the provided string parameter which was basically a class without the `.`, like `s_popup`, but not in all cases. A whole valid selector could also be provided, meaning that concatenating it with a leading `.` would result in incorrect selector. Basically, this commit revert the change made on [1] in `clickOnSnippet` to restore the code of [2] that was preventing the wrong selector creation. [1]: https://github.com/odoo/odoo/commit/99b50d18e220aedf14de806f4bf1b2d35c32de35 [2]: https://github.com/odoo/odoo/commit/e8a5af2e28a4724f86783746706cb59175f086bf opw-3026167 closes odoo/odoo#103651 X-original-commit: 26c4e4a13b642e2856495a8c1f5a36afe3996c02 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
committed by
Romain Derie
parent
a9702cee39
commit
86e5ae7954
@@ -171,9 +171,9 @@ function clickOnElement(elementName, selector) {
|
||||
* @param {*} position
|
||||
*/
|
||||
function clickOnSnippet(snippet, position = "bottom") {
|
||||
const snippetClass = snippet.id || snippet;
|
||||
const trigger = snippet.id ? `#wrapwrap .${snippet.id}` : snippet;
|
||||
return {
|
||||
trigger: `iframe #wrapwrap .${snippetClass}`,
|
||||
trigger: `iframe ${trigger}`,
|
||||
extra_trigger: "body.editor_has_snippets",
|
||||
content: Markup(_t("<b>Click on a snippet</b> to access its options menu.")),
|
||||
position: position,
|
||||
|
||||
Reference in New Issue
Block a user