From 5e5178eb66a8d1f617fa7c8bee8a9d31b2168db6 Mon Sep 17 00:00:00 2001 From: "Pierre Pulinckx (pipu)" Date: Thu, 24 Aug 2023 11:31:47 +0000 Subject: [PATCH] [FIX] website: fix lints in tour_utils Due to a problem with eslint configuration, few eslint errors were introduced during 09535ef5e67766d55dae294f6239d12e9ca12be0. In this commit, these errors are fixed. closes odoo/odoo#132963 Signed-off-by: Luca Vitali (luvi) --- .../website/static/src/js/tours/tour_utils.js | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/addons/website/static/src/js/tours/tour_utils.js b/addons/website/static/src/js/tours/tour_utils.js index 6860977af8b..a556ebb6bbc 100644 --- a/addons/website/static/src/js/tours/tour_utils.js +++ b/addons/website/static/src/js/tours/tour_utils.js @@ -319,58 +319,58 @@ function clickOnExtraMenuItem(stepOptions, backend = false) { * @param {object} options The tour options * @param {string} options.url The page to edit * @param {boolean} [options.edition] If the tour starts in edit mode - * @param {() => TourStep[]} steps The steps of the tour. Has to be a function to avoid direct interpolation of steps. + * @param {() => TourStep[]} steps The steps of the tour. Has to be a function to avoid direct interpolation of steps. */ function registerWebsitePreviewTour(name, options, steps) { - if(typeof steps !== "function") { - throw new Error(`tour.steps has to be a function that returns TourStep[]`) + if (typeof steps !== "function") { + throw new Error(`tour.steps has to be a function that returns TourStep[]`); } - return registry - .category("web_tour.tours") - .add(name, { - ...options, - url : getClientActionUrl(options.url, !!options.edition), - steps: () => { - const tourSteps = [...steps()]; - // Note: for both non edit mode and edit mode, we set a high timeout for the - // first step. Indeed loading both the backend and the frontend (in the - // iframe) and potentially starting the edit mode can take a long time in - // automatic tests. We'll try and decrease the need for this high timeout - // of course. - if (options.edition) { - tourSteps.unshift({ - content: "Wait for the edit mode to be started", - trigger: '.o_website_preview.editor_enable.editor_has_snippets', - timeout: 30000, - auto: true, - run: () => {}, // It's a check - }); - } else { - tourSteps[0].timeout = 20000; - } - return tourSteps; + return registry.category("web_tour.tours").add(name, { + ...options, + url: getClientActionUrl(options.url, !!options.edition), + steps: () => { + const tourSteps = [...steps()]; + // Note: for both non edit mode and edit mode, we set a high timeout for the + // first step. Indeed loading both the backend and the frontend (in the + // iframe) and potentially starting the edit mode can take a long time in + // automatic tests. We'll try and decrease the need for this high timeout + // of course. + if (options.edition) { + tourSteps.unshift({ + content: "Wait for the edit mode to be started", + trigger: ".o_website_preview.editor_enable.editor_has_snippets", + timeout: 30000, + auto: true, + run: () => {}, // It's a check + }); + } else { + tourSteps[0].timeout = 20000; } - }); + return tourSteps; + }, + }); } function registerThemeHomepageTour(name, steps) { - if(typeof steps !== "function") { - throw new Error(`tour.steps has to be a function that returns TourStep[]`) + if (typeof steps !== "function") { + throw new Error(`tour.steps has to be a function that returns TourStep[]`); } return registerWebsitePreviewTour(name, { url: '/', edition: true, sequence: 1010, saveAs: "homepage", - }, () => prepend_trigger( - steps().concat(clickOnSave()), + }, + () => + prepend_trigger( + steps().concat(clickOnSave()), ".o_website_preview[data-view-xmlid='website.homepage'] " )); } function registerBackendAndFrontendTour(name, options, steps) { - if(typeof steps !== "function") { - throw new Error(`tour.steps has to be a function that returns TourStep[]`) + if (typeof steps !== "function") { + throw new Error(`tour.steps has to be a function that returns TourStep[]`); } if (window.location.pathname === '/web') { return registerWebsitePreviewTour(name, options, () => { @@ -383,14 +383,14 @@ function registerBackendAndFrontendTour(name, options, steps) { } newSteps.push(newStep); } - return newSteps + return newSteps; }); } return registry.category("web_tour.tours").add(name, { url: options.url, steps: () => { - return steps() + return steps(); }, }); }