From b15959cd95923262299e50473b8d8ba91844642d Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Mon, 14 Mar 2022 09:14:53 +0000 Subject: [PATCH] [IMP] mail, *: make start method handle cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *: calendar, hr, hr_holidays, im_livechat, mail, mail_bot, note, sms, snailmail, website_livechat, website_slides. This commit prepares the removal of beforeEach function in the mail test suite. Cleanup was relying on beforeEach adding widgets, components, unpatch method 'this'. We need to clean things up without using either beforeEach or 'this'. task-2792108 closes odoo/odoo#86526 Related: odoo/enterprise#25326 Signed-off-by: Sébastien Theys (seb) --- .../tests/systray_activity_menu_tests.js | 5 +- .../static/tests/m2x_avatar_employee_tests.js | 4 - .../tests/partner_im_status_icon_tests.js | 4 - .../thread_icon/tests/thread_icon_tests.js | 4 - .../thread_view/tests/thread_view_tests.js | 7 +- .../tests/chat_window_manager_tests.js | 4 - .../composer/tests/composer_tests.js | 5 +- .../components/discuss/tests/discuss_tests.js | 4 - .../tests/discuss_sidebar_category_tests.js | 4 - .../discuss_sidebar_category_item_tests.js | 4 - .../tests/messaging_menu_tests.js | 4 - .../thread_icon/tests/thread_icon_tests.js | 4 - .../thread_textual_typing_status_tests.js | 4 - .../activity/tests/activity_tests.js | 8 +- .../tests/activity_mark_done_popover_tests.js | 8 +- .../tests/attachment_box_tests.js | 4 - .../tests/attachment_image_tests.js | 7 +- .../tests/attachment_list_tests.js | 7 +- .../tests/channel_invitation_form_tests.js | 4 - .../tests/chat_window_manager_tests.js | 4 - .../chatter_suggested_recipient_tests.js | 5 +- .../components/chatter/tests/chatter_tests.js | 5 +- .../tests/chatter_topbar_tests.js | 5 +- .../composer/tests/composer_tests.js | 7 +- ...mposer_suggestion_canned_response_tests.js | 5 +- .../composer_suggestion_channel_tests.js | 5 +- .../composer_suggestion_command_tests.js | 5 +- .../composer_suggestion_partner_tests.js | 5 +- .../tests/dialog_manager_tests.js | 4 - .../discuss/tests/discuss_inbox_tests.js | 4 - .../tests/discuss_message_edit_tests.js | 5 +- .../discuss/tests/discuss_pinned_tests.js | 4 - .../discuss/tests/discuss_sidebar_tests.js | 4 - .../components/discuss/tests/discuss_tests.js | 7 +- .../discuss_mobile_mailbox_selection_tests.js | 4 - .../tests/discuss_sidebar_category_tests.js | 4 - .../discuss_sidebar_category_item_tests.js | 4 - .../tests/file_uploader_tests.js | 9 +- .../tests/follow_button_tests.js | 4 - .../follower/tests/follower_tests.js | 4 - .../tests/follower_list_menu_tests.js | 4 - .../tests/follower_subtype_tests.js | 4 - .../components/message/tests/message_tests.js | 7 +- .../tests/message_seen_indicator_tests.js | 4 - .../tests/messaging_menu_tests.js | 4 - ...ification_list_notification_group_tests.js | 5 +- .../tests/notification_list_tests.js | 5 +- .../tests/partner_im_status_icon_tests.js | 4 - .../thread_icon/tests/thread_icon_tests.js | 4 - .../tests/thread_needaction_preview_tests.js | 5 +- .../tests/thread_preview_tests.js | 5 +- .../thread_textual_typing_status_tests.js | 4 - .../thread_view/tests/thread_view_tests.js | 7 +- .../tests/model_field_command/clear_tests.js | 4 - .../insert_and_replace_tests.js | 4 - .../tests/model_field_command/insert_tests.js | 4 - .../tests/model_field_command/link_tests.js | 4 - .../model_field_command/replace_tests.js | 4 - .../tests/model_field_command/set_tests.js | 4 - .../model_field_command/unlink_all_tests.js | 4 - .../tests/model_field_command/unlink_tests.js | 4 - .../attachment/tests/attachment_tests.js | 5 +- .../src/models/message/tests/message_tests.js | 5 +- .../models/messaging/tests/messaging_tests.js | 5 +- .../tests/messaging_menu_tests.js | 5 +- .../src/models/thread/tests/thread_tests.js | 5 +- addons/mail/static/src/utils/test_utils.js | 110 +++++++----------- .../utils/throttle/tests/throttle_tests.js | 3 +- .../src/utils/timer/tests/timer_tests.js | 3 +- .../tests/form_renderer_tests.js | 4 - .../tests/notification_alert_tests.js | 5 +- addons/mail/static/tests/chatter_tests.js | 8 +- addons/mail/static/tests/clock_model_tests.js | 5 +- .../static/tests/m2x_avatar_user_tests.js | 5 +- .../systray/systray_activity_menu_tests.js | 4 - .../commands/mail_providers_tests.js | 5 +- .../tests/messaging_initializer_tests.js | 5 +- .../tests/systray_activity_menu_tests.js | 5 +- .../components/message/tests/message_tests.js | 7 +- ...ification_list_notification_group_tests.js | 5 +- .../components/message/tests/message_tests.js | 7 +- ...ification_list_notification_group_tests.js | 5 +- .../components/discuss/tests/discuss_tests.js | 4 - .../messaging_notification_handler_tests.js | 4 - .../activity/tests/activity_tests.js | 8 +- 85 files changed, 91 insertions(+), 428 deletions(-) diff --git a/addons/calendar/static/tests/systray_activity_menu_tests.js b/addons/calendar/static/tests/systray_activity_menu_tests.js index 481f258f1bb..3cbd4e0f7c2 100644 --- a/addons/calendar/static/tests/systray_activity_menu_tests.js +++ b/addons/calendar/static/tests/systray_activity_menu_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import ActivityMenu from '@mail/js/systray/systray_activity_menu'; import testUtils from 'web.test_utils'; @@ -39,9 +39,6 @@ QUnit.module('ActivityMenu', { }, }); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('activity menu widget:today meetings', async function (assert) { diff --git a/addons/hr/static/tests/m2x_avatar_employee_tests.js b/addons/hr/static/tests/m2x_avatar_employee_tests.js index 3399c605a0a..5fb632efddc 100644 --- a/addons/hr/static/tests/m2x_avatar_employee_tests.js +++ b/addons/hr/static/tests/m2x_avatar_employee_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -51,9 +50,6 @@ QUnit.module('hr', {}, function () { { id: 13, display_name: "Yoshi" } ); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('many2one_avatar_employee widget in list view', async function (assert) { diff --git a/addons/hr_holidays/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js b/addons/hr_holidays/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js index 8fd3e0165e3..36d7f7e1254 100644 --- a/addons/hr_holidays/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js +++ b/addons/hr_holidays/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, beforeEach, createRootMessagingComponent, start, @@ -29,9 +28,6 @@ QUnit.module('partner_im_status_icon_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('on leave & online', async function (assert) { diff --git a/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js index ced19dbdd11..37758a216ff 100644 --- a/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, beforeEach, createRootMessagingComponent, start, @@ -30,9 +29,6 @@ QUnit.module('thread_icon_tests.js', { }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('thread icon of a chat when correspondent is on leave & online', async function (assert) { diff --git a/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js b/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js index 847eb72ff79..18d51152457 100644 --- a/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js +++ b/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace, link } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -16,17 +15,13 @@ QUnit.module('thread_view_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('out of office message on direct chat with out of office partner', async function (assert) { diff --git a/addons/im_livechat/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js b/addons/im_livechat/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js index 1a9ce10ef57..b163448a97e 100644 --- a/addons/im_livechat/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js +++ b/addons/im_livechat/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -28,9 +27,6 @@ QUnit.module('chat_window_manager_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('closing a chat window with no message from admin side unpins it', async function (assert) { diff --git a/addons/im_livechat/static/src/components/composer/tests/composer_tests.js b/addons/im_livechat/static/src/components/composer/tests/composer_tests.js index 09b6115591d..c8b91580c1d 100644 --- a/addons/im_livechat/static/src/components/composer/tests/composer_tests.js +++ b/addons/im_livechat/static/src/components/composer/tests/composer_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('im_livechat', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('composer_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechat: no add attachment button', async function (assert) { diff --git a/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js b/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js index fd3d0754c7c..9832895fc4c 100644 --- a/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -27,9 +26,6 @@ QUnit.module('discuss_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechat in the sidebar: basic rendering', async function (assert) { diff --git a/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js b/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js index e3eba161ec6..9938f85f851 100644 --- a/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js +++ b/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -24,9 +23,6 @@ QUnit.module('discuss_sidebar_category_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechat - counter: should not have a counter if the category is unfolded and without unread messages', async function (assert) { diff --git a/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js b/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js index 90744a4f54d..83190913a22 100644 --- a/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js +++ b/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -23,9 +22,6 @@ QUnit.module('discuss_sidebar_category_item_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechat - avatar: should have a smiley face avatar for an anonymous livechat item', async function (assert) { diff --git a/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js b/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js index cca1ee9e521..51e373b1dfa 100644 --- a/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js +++ b/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -24,9 +23,6 @@ QUnit.module('messaging_menu_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechats should be in "chat" filter', async function (assert) { diff --git a/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js index a04f16d6a51..af0369f521d 100644 --- a/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -30,9 +29,6 @@ QUnit.module('thread_icon_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('livechat: public website visitor is typing', async function (assert) { diff --git a/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js b/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js index 3b2f3088e12..927d4b57b66 100644 --- a/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js +++ b/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -30,9 +29,6 @@ QUnit.module('thread_textual_typing_status_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('receive visitor typing status "is typing"', async function (assert) { diff --git a/addons/mail/static/src/components/activity/tests/activity_tests.js b/addons/mail/static/src/components/activity/tests/activity_tests.js index 3d496f45024..aad81aeacfc 100644 --- a/addons/mail/static/src/components/activity/tests/activity_tests.js +++ b/addons/mail/static/src/components/activity/tests/activity_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; import { date_to_str } from 'web.time'; @@ -14,16 +14,12 @@ QUnit.module('activity_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { apps, env, widget } = res; - this.apps = apps; + const { env, widget } = res; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('activity simplest layout', async function (assert) { diff --git a/addons/mail/static/src/components/activity_mark_done_popover/tests/activity_mark_done_popover_tests.js b/addons/mail/static/src/components/activity_mark_done_popover/tests/activity_mark_done_popover_tests.js index 6262a72ccec..78a7432b129 100644 --- a/addons/mail/static/src/components/activity_mark_done_popover/tests/activity_mark_done_popover_tests.js +++ b/addons/mail/static/src/components/activity_mark_done_popover/tests/activity_mark_done_popover_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; @@ -13,16 +13,12 @@ QUnit.module('activity_mark_done_popover_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { apps, env, widget } = res; - this.apps = apps; + const { env, widget } = res; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('activity mark done popover simplest layout', async function (assert) { diff --git a/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js b/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js index 55338d64e60..3f3bc88f884 100644 --- a/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js +++ b/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, dragenterFiles, @@ -29,9 +28,6 @@ QUnit.module('attachment_box_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base empty rendering', async function (assert) { diff --git a/addons/mail/static/src/components/attachment_image/tests/attachment_image_tests.js b/addons/mail/static/src/components/attachment_image/tests/attachment_image_tests.js index 55dd8227d07..1c500a06a9c 100644 --- a/addons/mail/static/src/components/attachment_image/tests/attachment_image_tests.js +++ b/addons/mail/static/src/components/attachment_image/tests/attachment_image_tests.js @@ -2,7 +2,6 @@ import { link } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -16,17 +15,13 @@ QUnit.module('attachment_image_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('auto layout with image', async function (assert) { diff --git a/addons/mail/static/src/components/attachment_list/tests/attachment_list_tests.js b/addons/mail/static/src/components/attachment_list/tests/attachment_list_tests.js index 30b9720a216..18891bbb13f 100644 --- a/addons/mail/static/src/components/attachment_list/tests/attachment_list_tests.js +++ b/addons/mail/static/src/components/attachment_list/tests/attachment_list_tests.js @@ -3,7 +3,6 @@ import { link } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, start, @@ -18,17 +17,13 @@ QUnit.module('attachment_list_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('simplest layout', async function (assert) { diff --git a/addons/mail/static/src/components/channel_invitation_form/tests/channel_invitation_form_tests.js b/addons/mail/static/src/components/channel_invitation_form/tests/channel_invitation_form_tests.js index db691ffbde7..d9c5f5f95d1 100644 --- a/addons/mail/static/src/components/channel_invitation_form/tests/channel_invitation_form_tests.js +++ b/addons/mail/static/src/components/channel_invitation_form/tests/channel_invitation_form_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -24,9 +23,6 @@ QUnit.module('channel_invitation_form_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('should display the channel invitation form after clicking on the invite button of a chat', async function (assert) { diff --git a/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js b/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js index 7d578c7cbcb..5564ac7f178 100644 --- a/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js +++ b/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js @@ -2,7 +2,6 @@ import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -34,9 +33,6 @@ QUnit.module('chat_window_manager_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('[technical] messaging not created', async function (assert) { diff --git a/addons/mail/static/src/components/chatter/tests/chatter_suggested_recipient_tests.js b/addons/mail/static/src/components/chatter/tests/chatter_suggested_recipient_tests.js index ea2a5c6835c..d7b1ebb7f95 100644 --- a/addons/mail/static/src/components/chatter/tests/chatter_suggested_recipient_tests.js +++ b/addons/mail/static/src/components/chatter/tests/chatter_suggested_recipient_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -19,9 +19,6 @@ QUnit.module('chatter_suggested_recipients_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test("suggest recipient on 'Send message' composer", async function (assert) { diff --git a/addons/mail/static/src/components/chatter/tests/chatter_tests.js b/addons/mail/static/src/components/chatter/tests/chatter_tests.js index c069fd574be..20631fef3cf 100644 --- a/addons/mail/static/src/components/chatter/tests/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/tests/chatter_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, nextAnimationFrame, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, nextAnimationFrame, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('chatter_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base rendering when chatter has no attachment', async function (assert) { diff --git a/addons/mail/static/src/components/chatter_topbar/tests/chatter_topbar_tests.js b/addons/mail/static/src/components/chatter_topbar/tests/chatter_topbar_tests.js index 6ab55921e11..16a59f18440 100644 --- a/addons/mail/static/src/components/chatter_topbar/tests/chatter_topbar_tests.js +++ b/addons/mail/static/src/components/chatter_topbar/tests/chatter_topbar_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, nextAnimationFrame, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, nextAnimationFrame, start } from '@mail/utils/test_utils'; import { makeTestPromise } from 'web.test_utils'; @@ -21,9 +21,6 @@ QUnit.module('chatter_topbar_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base rendering', async function (assert) { diff --git a/addons/mail/static/src/components/composer/tests/composer_tests.js b/addons/mail/static/src/components/composer/tests/composer_tests.js index 06b4491f3f7..ef9ef1219d7 100644 --- a/addons/mail/static/src/components/composer/tests/composer_tests.js +++ b/addons/mail/static/src/components/composer/tests/composer_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, dragenterFiles, @@ -29,9 +28,8 @@ QUnit.module('composer_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; @@ -60,9 +58,6 @@ QUnit.module('composer_tests.js', { }); }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('composer text input: basic rendering when posting a message', async function (assert) { diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js index 1c9e950aed2..86af61f7d7b 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('composer_suggestion_canned_response_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('canned response suggestion displayed', async function (assert) { diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js index 4932e97f8c8..13e25d32956 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('composer_suggestion_channel_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('channel mention suggestion displayed', async function (assert) { diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js index 88409937be2..96c29fd2956 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('composer_suggestion_command_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('command suggestion displayed', async function (assert) { diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js index 099558ddd63..55896782005 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('composer_suggestion_partner_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('partner mention suggestion displayed', async function (assert) { diff --git a/addons/mail/static/src/components/dialog_manager/tests/dialog_manager_tests.js b/addons/mail/static/src/components/dialog_manager/tests/dialog_manager_tests.js index 9cf8a8271e4..1132ecfcb84 100644 --- a/addons/mail/static/src/components/dialog_manager/tests/dialog_manager_tests.js +++ b/addons/mail/static/src/components/dialog_manager/tests/dialog_manager_tests.js @@ -2,7 +2,6 @@ import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, beforeEach, nextAnimationFrame, start, @@ -25,9 +24,6 @@ QUnit.module('dialog_manager_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('[technical] messaging not created', async function (assert) { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js index 4375fed68dd..0c911161737 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -27,9 +26,6 @@ QUnit.module('discuss_inbox_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('reply: discard on pressing escape', async function (assert) { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_message_edit_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_message_edit_tests.js index 7b5a22fab49..679e14d351f 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_message_edit_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_message_edit_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -20,9 +20,6 @@ QUnit.module('discuss_message_edit_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('click on message edit button should open edit composer', async function (assert) { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js index 68ad3cfc361..2d2a01ac3da 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -24,9 +23,6 @@ QUnit.module('discuss_pinned_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('sidebar: pinned channel 1: init with one pinned channel', async function (assert) { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_sidebar_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_sidebar_tests.js index 951ac1292b1..4ddd1aa0832 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_sidebar_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_sidebar_tests.js @@ -2,7 +2,6 @@ import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -26,9 +25,6 @@ QUnit.module('discuss_sidebar_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('sidebar find shows channels matching search term', async function (assert) { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js index 1b4c04220a9..4c3a588bdd7 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -3,7 +3,6 @@ import BusService from 'bus.BusService'; import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -28,17 +27,13 @@ QUnit.module('discuss_tests.js', { data: this.data, hasDiscuss: true, })); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('messaging not created', async function (assert) { diff --git a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/mobile_tests/discuss_mobile_mailbox_selection_tests.js b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/mobile_tests/discuss_mobile_mailbox_selection_tests.js index 828fa790ed3..054fef9d7b4 100644 --- a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/mobile_tests/discuss_mobile_mailbox_selection_tests.js +++ b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/mobile_tests/discuss_mobile_mailbox_selection_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -36,9 +35,6 @@ QUnit.module('discuss_mobile_mailbox_selection_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('select another mailbox', async function (assert) { diff --git a/addons/mail/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js b/addons/mail/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js index 8c0d81357e1..ee106e11c26 100644 --- a/addons/mail/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js +++ b/addons/mail/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -24,9 +23,6 @@ QUnit.module('discuss_sidebar_category_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('channel - counter: should not have a counter if the category is unfolded and without needaction messages', async function (assert) { diff --git a/addons/mail/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js b/addons/mail/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js index 350a3a15f39..e188a34f4ce 100644 --- a/addons/mail/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js +++ b/addons/mail/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -26,9 +25,6 @@ QUnit.module('discuss_sidebar_category_item_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('channel - avatar: should have correct avatar', async function (assert) { diff --git a/addons/mail/static/src/components/file_uploader/tests/file_uploader_tests.js b/addons/mail/static/src/components/file_uploader/tests/file_uploader_tests.js index 8482f3a821a..62b584dca07 100644 --- a/addons/mail/static/src/components/file_uploader/tests/file_uploader_tests.js +++ b/addons/mail/static/src/components/file_uploader/tests/file_uploader_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import { file } from 'web.test_utils'; @@ -11,20 +11,15 @@ QUnit.module('file_uploader', {}, function () { QUnit.module('file_uploader_tests.js', { async beforeEach() { await beforeEach(this); - this.apps = []; this.start = async params => { const res = await start({ ...params, data: this.data }); - const { apps, env, widget } = res; + const { env, widget } = res; this.env = env; - this.apps = apps; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('no conflicts between file uploaders', async function (assert) { diff --git a/addons/mail/static/src/components/follow_button/tests/follow_button_tests.js b/addons/mail/static/src/components/follow_button/tests/follow_button_tests.js index 3d41b0f5737..ca9bffbcd7e 100644 --- a/addons/mail/static/src/components/follow_button/tests/follow_button_tests.js +++ b/addons/mail/static/src/components/follow_button/tests/follow_button_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -31,9 +30,6 @@ QUnit.module('follow_button_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base rendering not editable', async function (assert) { diff --git a/addons/mail/static/src/components/follower/tests/follower_tests.js b/addons/mail/static/src/components/follower/tests/follower_tests.js index ab947dcbdfe..fae21c21ef0 100644 --- a/addons/mail/static/src/components/follower/tests/follower_tests.js +++ b/addons/mail/static/src/components/follower/tests/follower_tests.js @@ -3,7 +3,6 @@ import { insert, link } from '@mail/model/model_field_command'; import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -34,9 +33,6 @@ QUnit.module('follower_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base rendering not editable', async function (assert) { diff --git a/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js b/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js index 1978e4dcac9..b357f51519b 100644 --- a/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js +++ b/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js @@ -2,7 +2,6 @@ import { insert, link } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -34,9 +33,6 @@ QUnit.module('follower_list_menu_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('base rendering not editable', async function (assert) { diff --git a/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js b/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js index c81307bb8ac..c311cc747bf 100644 --- a/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js +++ b/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js @@ -2,7 +2,6 @@ import { insert, link } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -35,9 +34,6 @@ QUnit.module('follower_subtype_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('simplest layout of a followed subtype', async function (assert) { diff --git a/addons/mail/static/src/components/message/tests/message_tests.js b/addons/mail/static/src/components/message/tests/message_tests.js index 7bfe385c2d4..af5fe676f25 100644 --- a/addons/mail/static/src/components/message/tests/message_tests.js +++ b/addons/mail/static/src/components/message/tests/message_tests.js @@ -3,7 +3,6 @@ import { insert, insertAndReplace, link, replace } from '@mail/model/model_field_command'; import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -22,17 +21,13 @@ QUnit.module('message_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('basic rendering', async function (assert) { diff --git a/addons/mail/static/src/components/message_seen_indicator/tests/message_seen_indicator_tests.js b/addons/mail/static/src/components/message_seen_indicator/tests/message_seen_indicator_tests.js index 8fa78b3e822..327e305aeb0 100644 --- a/addons/mail/static/src/components/message_seen_indicator/tests/message_seen_indicator_tests.js +++ b/addons/mail/static/src/components/message_seen_indicator/tests/message_seen_indicator_tests.js @@ -2,7 +2,6 @@ import { insert, insertAndReplace, link } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, createRootMessagingComponent, start, @@ -34,9 +33,6 @@ QUnit.module('message_seen_indicator_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('rendering when just one has received the message', async function (assert) { diff --git a/addons/mail/static/src/components/messaging_menu/tests/messaging_menu_tests.js b/addons/mail/static/src/components/messaging_menu/tests/messaging_menu_tests.js index 0e7ebe0b064..48bef9ecf6b 100644 --- a/addons/mail/static/src/components/messaging_menu/tests/messaging_menu_tests.js +++ b/addons/mail/static/src/components/messaging_menu/tests/messaging_menu_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -27,9 +26,6 @@ QUnit.module('messaging_menu_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('[technical] messaging not created then becomes created', async function (assert) { diff --git a/addons/mail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js b/addons/mail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js index c5fbe6e5c66..793ec7ae0c4 100644 --- a/addons/mail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js +++ b/addons/mail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start, } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start, } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; @@ -21,9 +21,6 @@ QUnit.module('notification_list_notification_group_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('notification group basic layout', async function (assert) { diff --git a/addons/mail/static/src/components/notification_list/tests/notification_list_tests.js b/addons/mail/static/src/components/notification_list/tests/notification_list_tests.js index 664161733c6..b0dd1a3da3c 100644 --- a/addons/mail/static/src/components/notification_list/tests/notification_list_tests.js +++ b/addons/mail/static/src/components/notification_list/tests/notification_list_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -19,9 +19,6 @@ QUnit.module('notification_list_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('marked as read thread notifications are ordered by last message date', async function (assert) { diff --git a/addons/mail/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js b/addons/mail/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js index 95b14deae67..a6234786deb 100644 --- a/addons/mail/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js +++ b/addons/mail/static/src/components/partner_im_status_icon/tests/partner_im_status_icon_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -30,9 +29,6 @@ QUnit.module('partner_im_status_icon_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('initially online', async function (assert) { diff --git a/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js index 383ee488ed2..785a3edcbd3 100644 --- a/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -31,9 +30,6 @@ QUnit.module('thread_icon_tests.js', { }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('chat: correspondent is typing', async function (assert) { diff --git a/addons/mail/static/src/components/thread_needaction_preview/tests/thread_needaction_preview_tests.js b/addons/mail/static/src/components/thread_needaction_preview/tests/thread_needaction_preview_tests.js index 17c4b2a3d9b..d7f58f48c0c 100644 --- a/addons/mail/static/src/components/thread_needaction_preview/tests/thread_needaction_preview_tests.js +++ b/addons/mail/static/src/components/thread_needaction_preview/tests/thread_needaction_preview_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; @@ -22,9 +22,6 @@ QUnit.module('thread_needaction_preview_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('mark as read', async function (assert) { diff --git a/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js b/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js index ed8bf22da98..35783db7786 100644 --- a/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js +++ b/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { @@ -19,9 +19,6 @@ QUnit.module('thread_preview_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('mark as read', async function (assert) { diff --git a/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js b/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js index 7a035094865..5fce9562a33 100644 --- a/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js +++ b/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, @@ -31,9 +30,6 @@ QUnit.module('thread_textual_typing_status_tests.js', { this.widget = widget; }; }, - async afterEach() { - afterEach(this); - }, }); QUnit.test('receive other member typing status "is typing"', async function (assert) { diff --git a/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js b/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js index 724c3c51e81..099865f7808 100644 --- a/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js +++ b/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js @@ -2,7 +2,6 @@ import { insert, insertAndReplace, link } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, dragenterFiles, @@ -18,17 +17,13 @@ QUnit.module('thread_view_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('dragover files on thread with composer', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/clear_tests.js b/addons/mail/static/src/model/tests/model_field_command/clear_tests.js index 75a3a5bcd00..5d7e220ccca 100644 --- a/addons/mail/static/src/model/tests/model_field_command/clear_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/clear_tests.js @@ -2,7 +2,6 @@ import { clear, insertAndReplace } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('clear_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('clear: should set attribute field undefined if there is no default value', async function (assert) { assert.expect(1); diff --git a/addons/mail/static/src/model/tests/model_field_command/insert_and_replace_tests.js b/addons/mail/static/src/model/tests/model_field_command/insert_and_replace_tests.js index 8d9d3814eda..1e2dd8f59fb 100644 --- a/addons/mail/static/src/model/tests/model_field_command/insert_and_replace_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/insert_and_replace_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('insert_and_replace_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('insertAndReplace: should create and link a new record for an empty x2one field', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/insert_tests.js b/addons/mail/static/src/model/tests/model_field_command/insert_tests.js index 3103e1176a0..31297fe2a36 100644 --- a/addons/mail/static/src/model/tests/model_field_command/insert_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/insert_tests.js @@ -2,7 +2,6 @@ import { insert, insertAndReplace } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('insert_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('insert: should create and link a new record for an empty x2one field', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/link_tests.js b/addons/mail/static/src/model/tests/model_field_command/link_tests.js index 07884d76b2b..8a8f4cb150c 100644 --- a/addons/mail/static/src/model/tests/model_field_command/link_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/link_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace, link } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('field_command_link_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('link: should link a record to an empty x2one field', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/replace_tests.js b/addons/mail/static/src/model/tests/model_field_command/replace_tests.js index 3ef8f0b7f77..585db2f5802 100644 --- a/addons/mail/static/src/model/tests/model_field_command/replace_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/replace_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace, replace } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('replace_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('replace: should link a record for an empty x2one field', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/set_tests.js b/addons/mail/static/src/model/tests/model_field_command/set_tests.js index d27aa44b9d1..bf367c70a17 100644 --- a/addons/mail/static/src/model/tests/model_field_command/set_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/set_tests.js @@ -6,7 +6,6 @@ import { set } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -25,9 +24,6 @@ QUnit.module('set_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('decrement: should decrease attribute field value', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/unlink_all_tests.js b/addons/mail/static/src/model/tests/model_field_command/unlink_all_tests.js index 2b7050ed5d2..a87a9a34dfd 100644 --- a/addons/mail/static/src/model/tests/model_field_command/unlink_all_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/unlink_all_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace, unlinkAll } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('unlink_all_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('unlinkAll: should set x2one field undefined', async function (assert) { diff --git a/addons/mail/static/src/model/tests/model_field_command/unlink_tests.js b/addons/mail/static/src/model/tests/model_field_command/unlink_tests.js index f920c632ab0..ae6e58be084 100644 --- a/addons/mail/static/src/model/tests/model_field_command/unlink_tests.js +++ b/addons/mail/static/src/model/tests/model_field_command/unlink_tests.js @@ -2,7 +2,6 @@ import { insertAndReplace, unlink } from '@mail/model/model_field_command'; import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -21,9 +20,6 @@ QUnit.module('unlink_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); diff --git a/addons/mail/static/src/models/attachment/tests/attachment_tests.js b/addons/mail/static/src/models/attachment/tests/attachment_tests.js index 1a27f1d3f81..2cfb54ebf0e 100644 --- a/addons/mail/static/src/models/attachment/tests/attachment_tests.js +++ b/addons/mail/static/src/models/attachment/tests/attachment_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('models', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('attachment_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('create (txt)', async function (assert) { diff --git a/addons/mail/static/src/models/message/tests/message_tests.js b/addons/mail/static/src/models/message/tests/message_tests.js index e7d2dd88f97..94553af17d7 100644 --- a/addons/mail/static/src/models/message/tests/message_tests.js +++ b/addons/mail/static/src/models/message/tests/message_tests.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { insert, insertAndReplace, link } from '@mail/model/model_field_command'; -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import { str_to_datetime } from 'web.time'; @@ -20,9 +20,6 @@ QUnit.module('message_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('create', async function (assert) { diff --git a/addons/mail/static/src/models/messaging/tests/messaging_tests.js b/addons/mail/static/src/models/messaging/tests/messaging_tests.js index ba0bc3d7d36..db02ce21b70 100644 --- a/addons/mail/static/src/models/messaging/tests/messaging_tests.js +++ b/addons/mail/static/src/models/messaging/tests/messaging_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('models', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('messaging_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }, function () { QUnit.test('openChat: display notification for partner without user', async function (assert) { diff --git a/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js b/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js index 6809a166abd..9a0a856bfec 100644 --- a/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js +++ b/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('models', {}, function () { @@ -14,9 +14,6 @@ QUnit.module('messaging_menu_tests.js', { this.env = env; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('messaging menu counter should ignore unread messages in channels that are unpinned', async function (assert) { diff --git a/addons/mail/static/src/models/thread/tests/thread_tests.js b/addons/mail/static/src/models/thread/tests/thread_tests.js index 89746b0b040..273691e57b6 100644 --- a/addons/mail/static/src/models/thread/tests/thread_tests.js +++ b/addons/mail/static/src/models/thread/tests/thread_tests.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { insert } from '@mail/model/model_field_command'; -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('models', {}, function () { @@ -18,9 +18,6 @@ QUnit.module('thread_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('inbox & starred mailboxes', async function (assert) { diff --git a/addons/mail/static/src/utils/test_utils.js b/addons/mail/static/src/utils/test_utils.js index f775ccd6b58..2b99af7c21a 100644 --- a/addons/mail/static/src/utils/test_utils.js +++ b/addons/mail/static/src/utils/test_utils.js @@ -25,7 +25,8 @@ import { } from 'web.test_utils'; import Widget from 'web.Widget'; import { registry } from '@web/core/registry'; -import { getFixture } from "@web/../tests/helpers/utils"; +import { registerCleanup } from "@web/../tests/helpers/cleanup"; +import { getFixture, patchWithCleanup } from "@web/../tests/helpers/utils"; import { createWebClient, getActionManagerServerData } from "@web/../tests/webclient/helpers"; import LegacyRegistry from "web.Registry"; @@ -257,29 +258,16 @@ async function beforeEach(self) { data[modelName] = { fields, records }; } - const originals = { - '_.debounce': _.debounce, - '_.throttle': _.throttle, - }; - - (function patch() { - // patch _.debounce and _.throttle to be fast and synchronous - _.debounce = _.identity; - _.throttle = _.identity; - })(); - - function unpatch() { - _.debounce = originals['_.debounce']; - _.throttle = originals['_.throttle']; - } - Object.assign(self, { - apps: [], data, - unpatch, widget: undefined }); + registerCleanup(() => { + self.widget = undefined; + self.env = undefined; + }); + Object.defineProperty(self, 'messaging', { get() { if (!this.env || !this.env.services.messaging) { @@ -290,25 +278,6 @@ async function beforeEach(self) { }); } -function afterEach(self) { - // The components must be destroyed before the widget, because the - // widget might destroy the models before destroying the components, - // and the components might still rely on messaging (or other) record(s). - while (self.apps.length > 0) { - self.apps.pop().destroy(); - } - if (self.widget) { - self.widget.destroy(); - self.widget = undefined; - } - if (self.messaging) { - self.messaging.delete(); - } - self.env = undefined; - self.unpatch(); -} - - function getAfterEvent({ messagingBus }) { /** * Returns a promise resolved after the expected event is received. @@ -359,7 +328,7 @@ function getAfterEvent({ messagingBus }) { * Creates a new root Component, with the given props, and mounts it on target. * Assumes that self.env is set to the correct value. * Components created this way are automatically registered for clean up after - * the test, which will happen when `afterEach` is called. + * the test. * * @param {Object} self the current QUnit instance * @param {Object} Component the class of the component to create @@ -375,7 +344,10 @@ async function createRootComponent(self, Component, { props = {}, target }) { env: self.env, test: true, }); - self.apps.push(app); + // The components must be destroyed before the widget, because the + // widget might destroy the models before destroying the components, + // and the components might still rely on messaging (or other) record(s). + registerCleanup(() => app.destroy()); let component; await afterNextRender(() => { component = app.mount(target); @@ -388,7 +360,7 @@ async function createRootComponent(self, Component, { props = {}, target }) { * componentName and with the given props, and mounts it on target. * Assumes that self.env is set to the correct value. * Components created this way are automatically registered for clean up after - * the test, which will happen when `afterEach` is called. + * the test. * * @param {Object} self the current QUnit instance * @param {string} componentName the class name of the component to create @@ -407,11 +379,11 @@ function getClick({ afterNextRender }) { }; } -function getCreateChatterContainerComponent({ afterEvent, apps, env, widget }) { +function getCreateChatterContainerComponent({ afterEvent, env, widget }) { return async function createChatterContainerComponent(props, { waitUntilMessagesLoaded = true } = {}) { let chatterContainerComponent; async function func() { - chatterContainerComponent = await createRootMessagingComponent({ apps, env }, "ChatterContainer", { + chatterContainerComponent = await createRootMessagingComponent({ env }, "ChatterContainer", { props, target: widget.el, }); @@ -438,67 +410,67 @@ function getCreateChatterContainerComponent({ afterEvent, apps, env, widget }) { }; } -function getCreateComposerComponent({ apps, env, modelManager, widget }) { +function getCreateComposerComponent({ env, modelManager, widget }) { return async function createComposerComponent(composer, props) { const composerView = modelManager.messaging.models['ComposerView'].create({ qunitTest: insertAndReplace({ composer: replace(composer), }), }); - return await createRootMessagingComponent({ apps, env }, "Composer", { + return await createRootMessagingComponent({ env }, "Composer", { props: { localId: composerView.localId, ...props }, target: widget.el, }); }; } -function getCreateComposerSuggestionComponent({ apps, env, modelManager, widget }) { +function getCreateComposerSuggestionComponent({ env, modelManager, widget }) { return async function createComposerSuggestionComponent(composer, props) { const composerView = modelManager.messaging.models['ComposerView'].create({ qunitTest: insertAndReplace({ composer: replace(composer), }), }); - await createRootMessagingComponent({ apps, env }, "ComposerSuggestion", { + await createRootMessagingComponent({ env }, "ComposerSuggestion", { props: { ...props, composerViewLocalId: composerView.localId }, target: widget.el, }); }; } -function getCreateMessageComponent({ apps, env, modelManager, widget }) { +function getCreateMessageComponent({ env, modelManager, widget }) { return async function createMessageComponent(message) { const messageView = modelManager.messaging.models['MessageView'].create({ message: replace(message), qunitTest: insertAndReplace(), }); - await createRootMessagingComponent({ apps, env }, "Message", { + await createRootMessagingComponent({ env }, "Message", { props: { localId: messageView.localId }, target: widget.el, }); }; } -function getCreateMessagingMenuComponent({ apps, env, widget }) { +function getCreateMessagingMenuComponent({ env, widget }) { return async function createMessagingMenuComponent() { - return await createRootComponent({ apps, env }, MessagingMenuContainer, { target: widget.el }); + return await createRootComponent({ env }, MessagingMenuContainer, { target: widget.el }); }; } -function getCreateNotificationListComponent({ apps, env, modelManager, widget }) { +function getCreateNotificationListComponent({ env, modelManager, widget }) { return async function createNotificationListComponent({ filter = 'all' } = {}) { const notificationListView = modelManager.messaging.models['NotificationListView'].create({ filter, qunitTestOwner: insertAndReplace(), }); - await createRootMessagingComponent({ apps, env }, "NotificationList", { + await createRootMessagingComponent({ env }, "NotificationList", { props: { localId: notificationListView.localId }, target: widget.el, }); }; } -function getCreateThreadViewComponent({ afterEvent, apps, env, widget }) { +function getCreateThreadViewComponent({ afterEvent, env, widget }) { return async function createThreadViewComponent(threadView, otherProps = {}, { isFixedSize = false, waitUntilMessagesLoaded = true } = {}) { let target; if (isFixedSize) { @@ -515,7 +487,7 @@ function getCreateThreadViewComponent({ afterEvent, apps, env, widget }) { target = widget.el; } async function func() { - return createRootMessagingComponent({ apps, env }, "ThreadView", { props: { localId: threadView.localId, ...otherProps }, target }); + return createRootMessagingComponent({ env }, "ThreadView", { props: { localId: threadView.localId, ...otherProps }, target }); } if (waitUntilMessagesLoaded) { await afterNextRender(() => afterEvent({ @@ -620,6 +592,11 @@ function getOpenDiscuss({ afterNextRender, discussWidget }) { * @returns {Object} */ async function start(param0 = {}) { + // patch _.debounce and _.throttle to be fast and synchronous. + patchWithCleanup(_, { + debounce: func => func, + throttle: func => func, + }); let callbacks = { init: [], mount: [], @@ -808,7 +785,6 @@ async function start(param0 = {}) { legacyPatch(widget, { destroy() { destroyCallbacks.forEach(callback => callback({ widget })); - this._super(...arguments); legacyUnpatch(widget); } }); @@ -836,15 +812,18 @@ async function start(param0 = {}) { testSetupDoneDeferred.resolve(); waitUntilEventPromise = Promise.resolve(); } - const apps = []; const result = { afterEvent, - apps, env: testEnv, mockServer, widget, }; const { modelManager } = testEnv.services.messaging; + registerCleanup(async() => { + widget.destroy(); + await modelManager.messagingInitializedPromise; + modelManager.messaging.delete(); + }); if (waitUntilMessagingCondition === 'created') { await modelManager.messagingCreatedPromise; } @@ -865,13 +844,13 @@ async function start(param0 = {}) { ...result, afterNextRender, click: getClick({ afterNextRender }), - createChatterContainerComponent: getCreateChatterContainerComponent({ afterEvent, apps, env: testEnv, widget }), - createComposerComponent: getCreateComposerComponent({ apps, env: testEnv, modelManager, widget }), - createComposerSuggestionComponent: getCreateComposerSuggestionComponent({ apps, env: testEnv, modelManager, widget }), - createMessageComponent: getCreateMessageComponent({ apps, env: testEnv, modelManager, widget }), - createMessagingMenuComponent: getCreateMessagingMenuComponent({ apps, env: testEnv, widget }), - createNotificationListComponent: getCreateNotificationListComponent({ apps, env: testEnv, modelManager, widget }), - createThreadViewComponent: getCreateThreadViewComponent({ afterEvent, apps, env: testEnv, widget }), + createChatterContainerComponent: getCreateChatterContainerComponent({ afterEvent, env: testEnv, widget }), + createComposerComponent: getCreateComposerComponent({ env: testEnv, modelManager, widget }), + createComposerSuggestionComponent: getCreateComposerSuggestionComponent({ env: testEnv, modelManager, widget }), + createMessageComponent: getCreateMessageComponent({ env: testEnv, modelManager, widget }), + createMessagingMenuComponent: getCreateMessagingMenuComponent({ env: testEnv, widget }), + createNotificationListComponent: getCreateNotificationListComponent({ env: testEnv, modelManager, widget }), + createThreadViewComponent: getCreateThreadViewComponent({ afterEvent, env: testEnv, widget }), messaging: modelManager.messaging, openDiscuss, }; @@ -931,7 +910,6 @@ function pasteFiles(el, files) { //------------------------------------------------------------------------------ export { - afterEach, afterNextRender, beforeEach, createRootMessagingComponent, diff --git a/addons/mail/static/src/utils/throttle/tests/throttle_tests.js b/addons/mail/static/src/utils/throttle/tests/throttle_tests.js index 4f4e3a02ef1..280408c337d 100644 --- a/addons/mail/static/src/utils/throttle/tests/throttle_tests.js +++ b/addons/mail/static/src/utils/throttle/tests/throttle_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import throttle from '@mail/utils/throttle/throttle'; import { nextTick } from '@mail/utils/utils'; @@ -30,7 +30,6 @@ QUnit.module('throttle_tests.js', { for (const t of this.throttles) { t.clear(); } - afterEach(this); }, }); diff --git a/addons/mail/static/src/utils/timer/tests/timer_tests.js b/addons/mail/static/src/utils/timer/tests/timer_tests.js index 2c3e2500424..5ea4677f7c2 100644 --- a/addons/mail/static/src/utils/timer/tests/timer_tests.js +++ b/addons/mail/static/src/utils/timer/tests/timer_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, nextTick, start } from '@mail/utils/test_utils'; +import { beforeEach, nextTick, start } from '@mail/utils/test_utils'; import Timer from '@mail/utils/timer/timer'; const { TimerClearedError } = Timer; @@ -29,7 +29,6 @@ QUnit.module('timer_tests.js', { for (const timer of this.timers) { timer.clear(); } - afterEach(this); }, }); diff --git a/addons/mail/static/src/widgets/form_renderer/tests/form_renderer_tests.js b/addons/mail/static/src/widgets/form_renderer/tests/form_renderer_tests.js index d18085eee0c..19a294c8c5c 100644 --- a/addons/mail/static/src/widgets/form_renderer/tests/form_renderer_tests.js +++ b/addons/mail/static/src/widgets/form_renderer/tests/form_renderer_tests.js @@ -2,7 +2,6 @@ import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, nextAnimationFrame, @@ -48,9 +47,6 @@ QUnit.module('form_renderer_tests.js', { }); }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('[technical] spinner when messaging is not created', async function (assert) { diff --git a/addons/mail/static/src/widgets/notification_alert/tests/notification_alert_tests.js b/addons/mail/static/src/widgets/notification_alert/tests/notification_alert_tests.js index d7b305c4eaf..7bd50d6c3c0 100644 --- a/addons/mail/static/src/widgets/notification_alert/tests/notification_alert_tests.js +++ b/addons/mail/static/src/widgets/notification_alert/tests/notification_alert_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import FormView from 'web.FormView'; @@ -27,9 +27,6 @@ QUnit.module('notification_alert_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.skip('notification_alert widget: display blocked notification alert', async function (assert) { diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 2fdb5dd1a13..c563f0401fb 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import FormView from 'web.FormView'; import ListView from 'web.ListView'; @@ -97,9 +97,6 @@ QUnit.module('Chatter', { }, }); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('list activity widget with no activity', async function (assert) { @@ -397,9 +394,6 @@ QUnit.module('FieldMany2ManyTagsEmail', { { id: 14, display_name: "silver", email: '' } ); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('fieldmany2many tags email', function (assert) { diff --git a/addons/mail/static/tests/clock_model_tests.js b/addons/mail/static/tests/clock_model_tests.js index 04acd34791b..1221ad5e98f 100644 --- a/addons/mail/static/tests/clock_model_tests.js +++ b/addons/mail/static/tests/clock_model_tests.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { insertAndReplace } from '@mail/model/model_field_command'; -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail', {}, function () { QUnit.module('clock_model_tests', { @@ -17,9 +17,6 @@ QUnit.module('clock_model_tests', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('Deleting all the watchers of a clock should result in the deletion of the clock itself.', async function (assert) { diff --git a/addons/mail/static/tests/m2x_avatar_user_tests.js b/addons/mail/static/tests/m2x_avatar_user_tests.js index eb405925e17..49703e09079 100644 --- a/addons/mail/static/tests/m2x_avatar_user_tests.js +++ b/addons/mail/static/tests/m2x_avatar_user_tests.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { Many2OneAvatarUser } from '@mail/js/m2x_avatar_user'; -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import { click, getFixture, legacyExtraNextTick, patchWithCleanup, triggerHotkey } from "@web/../tests/helpers/utils"; import { doAction } from '@web/../tests/webclient/helpers'; import { registry } from "@web/core/registry"; @@ -52,9 +52,6 @@ QUnit.module('mail', {}, function () { target = getFixture(); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('many2one_avatar_user widget in list view', async function (assert) { diff --git a/addons/mail/static/tests/systray/systray_activity_menu_tests.js b/addons/mail/static/tests/systray/systray_activity_menu_tests.js index c940880f777..ac079d43001 100644 --- a/addons/mail/static/tests/systray/systray_activity_menu_tests.js +++ b/addons/mail/static/tests/systray/systray_activity_menu_tests.js @@ -2,7 +2,6 @@ import ActivityMenu from '@mail/js/systray/systray_activity_menu'; import { - afterEach, afterNextRender, beforeEach, start, @@ -83,9 +82,6 @@ QUnit.module('ActivityMenu', { uid: 10, }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('activity menu widget: menu with no records', async function (assert) { diff --git a/addons/mail/static/tests/webclient/commands/mail_providers_tests.js b/addons/mail/static/tests/webclient/commands/mail_providers_tests.js index f7954936468..bd1c9a927ca 100644 --- a/addons/mail/static/tests/webclient/commands/mail_providers_tests.js +++ b/addons/mail/static/tests/webclient/commands/mail_providers_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; +import { afterNextRender, beforeEach, start } from '@mail/utils/test_utils'; import { editSearchBar } from '@web/../tests/core/commands/command_service_tests'; import { click, getFixture, nextTick, patchWithCleanup, triggerHotkey } from "@web/../tests/helpers/utils"; import { browser } from '@web/core/browser/browser'; @@ -22,9 +22,6 @@ QUnit.module('mail', {}, function () { }); registry.category("command_categories").add("default", { label: ("default") }); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('open the chatWindow of a user from the command palette', async function (assert) { diff --git a/addons/mail_bot/static/src/models/messaging_initializer/tests/messaging_initializer_tests.js b/addons/mail_bot/static/src/models/messaging_initializer/tests/messaging_initializer_tests.js index c19090dcd28..28a25d74d69 100644 --- a/addons/mail_bot/static/src/models/messaging_initializer/tests/messaging_initializer_tests.js +++ b/addons/mail_bot/static/src/models/messaging_initializer/tests/messaging_initializer_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('mail_bot', {}, function () { QUnit.module('models', {}, function () { @@ -17,9 +17,6 @@ QUnit.module('messaging_initializer_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); diff --git a/addons/note/static/tests/systray_activity_menu_tests.js b/addons/note/static/tests/systray_activity_menu_tests.js index a1b1585d76c..0be2674493f 100644 --- a/addons/note/static/tests/systray_activity_menu_tests.js +++ b/addons/note/static/tests/systray_activity_menu_tests.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import ActivityMenu from '@mail/js/systray/systray_activity_menu'; -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import testUtils from 'web.test_utils'; @@ -31,9 +31,6 @@ QUnit.module("ActivityMenu", { } }); }, - afterEach() { - afterEach(this); - }, }); QUnit.test('note activity menu widget: create note from activity menu', async function (assert) { diff --git a/addons/sms/static/src/components/message/tests/message_tests.js b/addons/sms/static/src/components/message/tests/message_tests.js index 8ff413f9523..44671914300 100644 --- a/addons/sms/static/src/components/message/tests/message_tests.js +++ b/addons/sms/static/src/components/message/tests/message_tests.js @@ -3,7 +3,6 @@ import { insert, insertAndReplace } from '@mail/model/model_field_command'; import { makeDeferred } from '@mail/utils/deferred/deferred'; import { - afterEach, afterNextRender, beforeEach, start, @@ -20,17 +19,13 @@ QUnit.module('message_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('Notification Sent', async function (assert) { diff --git a/addons/sms/static/src/components/notification_list/tests/notification_list_notification_group_tests.js b/addons/sms/static/src/components/notification_list/tests/notification_list_notification_group_tests.js index 7106bef2f6b..c646a83961d 100644 --- a/addons/sms/static/src/components/notification_list/tests/notification_list_notification_group_tests.js +++ b/addons/sms/static/src/components/notification_list/tests/notification_list_notification_group_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; @@ -21,9 +21,6 @@ QUnit.module('notification_list_notification_group_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('mark as read', async function (assert) { diff --git a/addons/snailmail/static/src/components/message/tests/message_tests.js b/addons/snailmail/static/src/components/message/tests/message_tests.js index 637a181ddeb..3a0e9bcffe5 100644 --- a/addons/snailmail/static/src/components/message/tests/message_tests.js +++ b/addons/snailmail/static/src/components/message/tests/message_tests.js @@ -2,7 +2,6 @@ import { insert, insertAndReplace } from '@mail/model/model_field_command'; import { - afterEach, afterNextRender, beforeEach, start, @@ -19,17 +18,13 @@ QUnit.module('message_tests.js', { this.start = async params => { const res = await start({ ...params, data: this.data }); - const { afterEvent, apps, env, widget } = res; + const { afterEvent, env, widget } = res; this.afterEvent = afterEvent; - this.apps = apps; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('Sent', async function (assert) { diff --git a/addons/snailmail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js b/addons/snailmail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js index 891d1fa5da5..2995fb2a086 100644 --- a/addons/snailmail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js +++ b/addons/snailmail/static/src/components/notification_list/tests/notification_list_notification_group_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; import Bus from 'web.Bus'; @@ -21,9 +21,6 @@ QUnit.module('notification_list_notification_group_tests.js', { return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('mark as read', async function (assert) { diff --git a/addons/website_livechat/static/src/components/discuss/tests/discuss_tests.js b/addons/website_livechat/static/src/components/discuss/tests/discuss_tests.js index 5f3d3e96081..05d96c3cc86 100644 --- a/addons/website_livechat/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/website_livechat/static/src/components/discuss/tests/discuss_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, beforeEach, start, } from '@mail/utils/test_utils'; @@ -23,9 +22,6 @@ QUnit.module('discuss_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('rendering of visitor banner', async function (assert) { diff --git a/addons/website_livechat/static/src/models/messaging_notification_handler/tests/messaging_notification_handler_tests.js b/addons/website_livechat/static/src/models/messaging_notification_handler/tests/messaging_notification_handler_tests.js index 3957355fe02..68d4de3f746 100644 --- a/addons/website_livechat/static/src/models/messaging_notification_handler/tests/messaging_notification_handler_tests.js +++ b/addons/website_livechat/static/src/models/messaging_notification_handler/tests/messaging_notification_handler_tests.js @@ -1,7 +1,6 @@ /** @odoo-module **/ import { - afterEach, afterNextRender, beforeEach, start, @@ -25,9 +24,6 @@ QUnit.module('messaging_notification_handler_tests.js', { this.widget = widget; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('should open chat window on send chat request to website visitor', async function (assert) { diff --git a/addons/website_slides/static/src/components/activity/tests/activity_tests.js b/addons/website_slides/static/src/components/activity/tests/activity_tests.js index 850b6737e60..e2e64498382 100644 --- a/addons/website_slides/static/src/components/activity/tests/activity_tests.js +++ b/addons/website_slides/static/src/components/activity/tests/activity_tests.js @@ -1,6 +1,6 @@ /** @odoo-module **/ -import { afterEach, beforeEach, start } from '@mail/utils/test_utils'; +import { beforeEach, start } from '@mail/utils/test_utils'; QUnit.module('website_slides', {}, function () { QUnit.module('components', {}, function () { @@ -10,16 +10,12 @@ QUnit.module('activity_tests.js', { await beforeEach(this); this.start = async params => { const res = await start({ ...params, data: this.data }); - const { apps, env, widget } = res; - this.apps = apps; + const { env, widget } = res; this.env = env; this.widget = widget; return res; }; }, - afterEach() { - afterEach(this); - }, }); QUnit.test('grant course access', async function (assert) {