diff --git a/addons/mail/static/src/components/chatter/chatter_tests.js b/addons/mail/static/src/components/chatter/chatter_tests.js index d5c2932a6d7..e44ccd81115 100644 --- a/addons/mail/static/src/components/chatter/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/chatter_tests.js @@ -9,6 +9,7 @@ const { afterNextRender, beforeEach, createRootComponent, + nextAnimationFrame, start, } = require('mail/static/src/utils/test_utils.js'); @@ -436,10 +437,9 @@ QUnit.test('do not post message with "Enter" keyboard shortcut', async function document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message', 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 2983fcc11b2..c12e47f02cf 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -7,6 +7,7 @@ const { afterEach, afterNextRender, beforeEach, + nextAnimationFrame, start, } = require('mail/static/src/utils/test_utils.js'); @@ -2950,10 +2951,9 @@ QUnit.test('do not post message on non-mailing channel with "SHIFT-Enter" keyboa document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter", shiftKey: true }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter", shiftKey: true }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message', @@ -3058,10 +3058,9 @@ QUnit.test('do not post message on mailing channel with "Enter" keyboard shortcu document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message',