From 965fed0cd6dd644321056beb96caad82968a4bbe Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Fri, 10 Feb 2023 11:09:10 +0000 Subject: [PATCH] [REF] *: add dialogService in setupControlPanelServiceRegistry From a practical point of view, it seems better to also add the dialog service in the service registry when calling setupControlPanelServiceRegistry. closes odoo/odoo#113610 Related: odoo/enterprise#37510 Signed-off-by: Aaron Bohy (aab) --- addons/hr_timesheet/static/tests/timesheet_graph_tests.js | 2 -- addons/project/static/tests/burndown_chart_tests.js | 2 -- addons/web/static/tests/legacy/views/state_mapping_tests.js | 3 --- addons/web/static/tests/search/custom_favorite_item_tests.js | 2 -- addons/web/static/tests/search/favorite_menu_tests.js | 3 --- addons/web/static/tests/search/helpers.js | 4 +++- addons/web/static/tests/views/helpers.js | 2 -- addons/web/static/tests/views/layout_tests.js | 5 ----- addons/web/static/tests/views/pivot_view_tests.js | 2 -- .../tests/views/view_dialogs/form_view_dialog_tests.js | 5 ----- 10 files changed, 3 insertions(+), 27 deletions(-) diff --git a/addons/hr_timesheet/static/tests/timesheet_graph_tests.js b/addons/hr_timesheet/static/tests/timesheet_graph_tests.js index 91092343897..74198eef6cf 100644 --- a/addons/hr_timesheet/static/tests/timesheet_graph_tests.js +++ b/addons/hr_timesheet/static/tests/timesheet_graph_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { companyService } from "@web/webclient/company_service"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { getGraphRenderer } from "@web/../tests/views/graph_view_tests"; import { makeView } from "@web/../tests/views/helpers"; import { patchWithCleanup } from "@web/../tests/helpers/utils"; @@ -37,7 +36,6 @@ QUnit.module('hr_timesheet', function (hooks) { } setupControlPanelServiceRegistry(); serviceRegistry.add("company", companyService, { force: true }); - serviceRegistry.add("dialog", dialogService); }); QUnit.module("hr_timesheet_graphview"); diff --git a/addons/project/static/tests/burndown_chart_tests.js b/addons/project/static/tests/burndown_chart_tests.js index 171f27424b1..94fb5e716f1 100644 --- a/addons/project/static/tests/burndown_chart_tests.js +++ b/addons/project/static/tests/burndown_chart_tests.js @@ -3,7 +3,6 @@ import { browser } from "@web/core/browser/browser"; import { click, getFixture, patchWithCleanup } from "@web/../tests/helpers/utils"; import { setupControlPanelServiceRegistry, toggleGroupByMenu, toggleMenuItem, toggleMenuItemOption } from "@web/../tests/search/helpers"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { makeView } from "@web/../tests/views/helpers"; import { registry } from "@web/core/registry"; import { makeFakeNotificationService, fakeCookieService } from "@web/../tests/helpers/mock_services"; @@ -74,7 +73,6 @@ QUnit.module("Project", {}, () => { registry.category("services").add("notification", makeFakeNotificationService(notificationMock), { force: true, }); - serviceRegistry.add("dialog", dialogService); serviceRegistry.add("cookie", fakeCookieService); }); diff --git a/addons/web/static/tests/legacy/views/state_mapping_tests.js b/addons/web/static/tests/legacy/views/state_mapping_tests.js index cd6b9ad093f..2cf6d449902 100644 --- a/addons/web/static/tests/legacy/views/state_mapping_tests.js +++ b/addons/web/static/tests/legacy/views/state_mapping_tests.js @@ -14,7 +14,6 @@ import { toggleSaveFavorite, } from "@web/../tests/search/helpers"; import { createWebClient, doAction } from "@web/../tests/webclient/helpers"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { _lt } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; import { ControlPanel } from "@web/search/control_panel/control_panel"; @@ -27,7 +26,6 @@ import { browser } from "@web/core/browser/browser"; import { LegacyComponent } from "@web/legacy/legacy_component"; import { xml } from "@odoo/owl"; -const serviceRegistry = registry.category("services"); const viewRegistry = registry.category("views"); let serverData; @@ -77,7 +75,6 @@ QUnit.module("LegacyViews", (hooks) => { }; setupControlPanelFavoriteMenuRegistry(); setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); class ToyController extends LegacyComponent {} ToyController.template = xml`
`; diff --git a/addons/web/static/tests/search/custom_favorite_item_tests.js b/addons/web/static/tests/search/custom_favorite_item_tests.js index e34f7efa4e5..1fbe3c9ef7e 100644 --- a/addons/web/static/tests/search/custom_favorite_item_tests.js +++ b/addons/web/static/tests/search/custom_favorite_item_tests.js @@ -2,7 +2,6 @@ import { getFixture, patchWithCleanup, triggerEvent } from "@web/../tests/helpers/utils"; import { browser } from "@web/core/browser/browser"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { registry } from "@web/core/registry"; import { ControlPanel } from "@web/search/control_panel/control_panel"; import { FavoriteMenu } from "@web/search/favorite_menu/favorite_menu"; @@ -64,7 +63,6 @@ QUnit.module("Search", (hooks) => { }; setupControlPanelFavoriteMenuRegistry(); setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); patchWithCleanup(browser, { setTimeout: (fn) => fn(), clearTimeout: () => {}, diff --git a/addons/web/static/tests/search/favorite_menu_tests.js b/addons/web/static/tests/search/favorite_menu_tests.js index 17bd093cc19..79d0fbff210 100644 --- a/addons/web/static/tests/search/favorite_menu_tests.js +++ b/addons/web/static/tests/search/favorite_menu_tests.js @@ -2,7 +2,6 @@ import { click, getFixture, patchDate } from "@web/../tests/helpers/utils"; import { createWebClient, doAction } from "@web/../tests/webclient/helpers"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { registry } from "@web/core/registry"; import { ControlPanel } from "@web/search/control_panel/control_panel"; import { FavoriteMenu } from "@web/search/favorite_menu/favorite_menu"; @@ -20,7 +19,6 @@ import { } from "@web/../tests/search/helpers"; import { Component, onWillUpdateProps, xml } from "@odoo/owl"; -const serviceRegistry = registry.category("services"); const viewRegistry = registry.category("views"); const favoriteMenuRegistry = registry.category("favoriteMenu"); @@ -52,7 +50,6 @@ QUnit.module("Search", (hooks) => { }; setupControlPanelFavoriteMenuRegistry(); setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); }); QUnit.module("FavoriteMenu"); diff --git a/addons/web/static/tests/search/helpers.js b/addons/web/static/tests/search/helpers.js index 72079315150..aa826c3cb28 100644 --- a/addons/web/static/tests/search/helpers.js +++ b/addons/web/static/tests/search/helpers.js @@ -10,6 +10,8 @@ import { nextTick, triggerEvent, } from "@web/../tests/helpers/utils"; +import { dialogService } from "@web/core/dialog/dialog_service"; +import { Component, xml } from "@odoo/owl"; import { hotkeyService } from "@web/core/hotkeys/hotkey_service"; import { notificationService } from "@web/core/notifications/notification_service"; import { ormService } from "@web/core/orm_service"; @@ -20,12 +22,12 @@ import { getDefaultConfig } from "@web/views/view"; import { viewService } from "@web/views/view_service"; import { actionService } from "@web/webclient/actions/action_service"; -import { Component, xml } from "@odoo/owl"; const serviceRegistry = registry.category("services"); const favoriteMenuRegistry = registry.category("favoriteMenu"); export function setupControlPanelServiceRegistry() { serviceRegistry.add("action", actionService); + serviceRegistry.add("dialog", dialogService); serviceRegistry.add("hotkey", hotkeyService); serviceRegistry.add("notification", notificationService); serviceRegistry.add("orm", ormService); diff --git a/addons/web/static/tests/views/helpers.js b/addons/web/static/tests/views/helpers.js index ae043c5b742..54eca831aa7 100644 --- a/addons/web/static/tests/views/helpers.js +++ b/addons/web/static/tests/views/helpers.js @@ -17,7 +17,6 @@ import { makeFakeUserService, } from "../helpers/mock_services"; import { commandService } from "@web/core/commands/command_service"; -import { dialogService } from "@web/core/dialog/dialog_service"; import { popoverService } from "@web/core/popover/popover_service"; import { createDebugContext } from "@web/core/debug/debug_context"; @@ -108,7 +107,6 @@ export function setupViewRegistries() { ); serviceRegistry.add("router", makeFakeRouterService(), { force: true }); serviceRegistry.add("localization", makeFakeLocalizationService()), { force: true }; - serviceRegistry.add("dialog", dialogService), { force: true }; serviceRegistry.add("popover", popoverService), { force: true }; serviceRegistry.add("company", fakeCompanyService); serviceRegistry.add("command", commandService); diff --git a/addons/web/static/tests/views/layout_tests.js b/addons/web/static/tests/views/layout_tests.js index dbfaac83b16..aed7b729487 100644 --- a/addons/web/static/tests/views/layout_tests.js +++ b/addons/web/static/tests/views/layout_tests.js @@ -2,8 +2,6 @@ import { getFixture, mount, nextTick } from "@web/../tests/helpers/utils"; import { makeWithSearch, setupControlPanelServiceRegistry } from "@web/../tests/search/helpers"; -import { dialogService } from "@web/core/dialog/dialog_service"; -import { registry } from "@web/core/registry"; import { Layout } from "@web/search/layout"; import { getDefaultConfig } from "@web/views/view"; import { makeTestEnv } from "@web/../tests/helpers/mock_env"; @@ -12,8 +10,6 @@ import { SearchModel } from "@web/search/search_model"; import { Component, xml, onWillStart, useChildSubEnv, useSubEnv } from "@odoo/owl"; import { useService } from "@web/core/utils/hooks"; -const serviceRegistry = registry.category("services"); - let target; let serverData; @@ -45,7 +41,6 @@ QUnit.module("Views", (hooks) => { }; setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); target = getFixture(); }); diff --git a/addons/web/static/tests/views/pivot_view_tests.js b/addons/web/static/tests/views/pivot_view_tests.js index e91d459b70f..b8befa228ad 100644 --- a/addons/web/static/tests/views/pivot_view_tests.js +++ b/addons/web/static/tests/views/pivot_view_tests.js @@ -1,6 +1,5 @@ /** @odoo-module **/ -import { dialogService } from "@web/core/dialog/dialog_service"; import { registry } from "@web/core/registry"; import { session } from "@web/session"; import { makeFakeLocalizationService, makeFakeUserService } from "../helpers/mock_services"; @@ -192,7 +191,6 @@ QUnit.module("Views", (hooks) => { }; setupControlPanelFavoriteMenuRegistry(); setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); serviceRegistry.add("localization", makeFakeLocalizationService()); serviceRegistry.add("user", makeFakeUserService()); patchWithCleanup(browser, { setTimeout: (fn) => fn() }); diff --git a/addons/web/static/tests/views/view_dialogs/form_view_dialog_tests.js b/addons/web/static/tests/views/view_dialogs/form_view_dialog_tests.js index d0a314756df..13fe43618b4 100644 --- a/addons/web/static/tests/views/view_dialogs/form_view_dialog_tests.js +++ b/addons/web/static/tests/views/view_dialogs/form_view_dialog_tests.js @@ -9,13 +9,9 @@ import { } from "@web/../tests/helpers/utils"; import { makeView } from "@web/../tests/views/helpers"; import { createWebClient } from "@web/../tests/webclient/helpers"; -import { dialogService } from "@web/core/dialog/dialog_service"; -import { registry } from "@web/core/registry"; import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog"; import { setupControlPanelServiceRegistry } from "@web/../tests/search/helpers"; -const serviceRegistry = registry.category("services"); - QUnit.module("ViewDialogs", (hooks) => { let serverData; let target; @@ -70,7 +66,6 @@ QUnit.module("ViewDialogs", (hooks) => { }; target = getFixture(); setupControlPanelServiceRegistry(); - serviceRegistry.add("dialog", dialogService); }); QUnit.module("FormViewDialog");