From ca28cff17dd23a9a22a2ec775dfca10ae957a6cb Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 25 Jan 2022 13:39:38 +0000 Subject: [PATCH] [FIX] web,mail: fix wrong assertions in tests This is not a big deal, but by passing a widget instance or a DOM node as message to a QUnit.assert function, QUnit keeps a reference to that instance or DOM element, and it can never be garbage collected (nor its bound handlers in the case of a DOM element). For the mail case, this was a bit more critical as we didn't check what the author of the test actually wanted to check. closes odoo/odoo#83384 X-original-commit: 692fd6ecee602f7ceaae093b855aff65d50ca797 Signed-off-by: Samuel Degueldre Signed-off-by: Aaron Bohy (aab) --- .../chat_window_manager/tests/chat_window_manager_tests.js | 2 +- addons/web/static/tests/legacy/views/form_tests.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 0f58bbc3e24..496a7b502c1 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 @@ -161,7 +161,7 @@ QUnit.test('chat window new message: focused on open [REQUIRE FOCUS]', async fun document.querySelector(`.o_ChatWindow`).classList.contains('o-focused'), "chat window should be focused" ); - assert.ok( + assert.strictEqual( document.activeElement, document.querySelector(`.o_ChatWindow_newMessageFormInput`), "chat window focused = selection input focused" diff --git a/addons/web/static/tests/legacy/views/form_tests.js b/addons/web/static/tests/legacy/views/form_tests.js index 48978dae13c..95bb3643c7c 100644 --- a/addons/web/static/tests/legacy/views/form_tests.js +++ b/addons/web/static/tests/legacy/views/form_tests.js @@ -1933,7 +1933,7 @@ QUnit.module('Views', { res_id: 1, }); - assert.containsOnce(form, 'span.o_required_modifier', form); + assert.containsOnce(form, 'span.o_required_modifier'); await testUtils.form.clickEdit(form); assert.containsOnce(form, 'input.o_required_modifier',