From 8e2d0e9f8d07aa64038fbcf8dda07daa03f1b761 Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Tue, 12 Sep 2023 14:08:35 +0200 Subject: [PATCH] [IMP] mail: port test from 135122 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR import the test created in https://github.com/odoo/odoo/pull/135122 closes odoo/odoo#135183 Signed-off-by: Alexandre Kühn (aku) --- .../tests/suggestion/suggestion_tests.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/addons/mail/static/tests/suggestion/suggestion_tests.js b/addons/mail/static/tests/suggestion/suggestion_tests.js index ac717f8ad93..3e5044da22f 100644 --- a/addons/mail/static/tests/suggestion/suggestion_tests.js +++ b/addons/mail/static/tests/suggestion/suggestion_tests.js @@ -249,3 +249,36 @@ QUnit.test("display partner mention when typing more than 2 words if they match" await contains(".o-mail-Composer-suggestion"); await contains(".o-mail-Composer-suggestion strong", { text: "My Test Partner" }); }); + +QUnit.test("Internal user should be displayed first", async () => { + const pyEnv = await startServer(); + const [user1Id, user2Id] = pyEnv["res.users"].create([{ share: true }, { share: true }]); + const partnerIds = pyEnv["res.partner"].create([ + { name: "Person A" }, + { name: "Person B" }, + { name: "Person C", user_ids: [user1Id] }, + { name: "Person D", user_ids: [user2Id] }, + ]); + pyEnv["mail.followers"].create([ + { + is_active: true, + partner_id: partnerIds[1], // B + res_id: pyEnv.currentPartnerId, + res_model: "res.partner", + }, + { + is_active: true, + partner_id: partnerIds[3], // D + res_id: pyEnv.currentPartnerId, + res_model: "res.partner", + }, + ]); + const { openFormView } = await start(); + openFormView("res.partner", pyEnv.currentPartnerId); + await click("button", { text: "Send message" }); + await insertText(".o-mail-Composer-input", "@Person "); + await contains(":nth-child(1 of .o-mail-Composer-suggestion) strong", { text: "Person D" }); + await contains(":nth-child(2 of .o-mail-Composer-suggestion) strong", { text: "Person C" }); + await contains(":nth-child(3 of .o-mail-Composer-suggestion) strong", { text: "Person B" }); + await contains(":nth-child(4 of .o-mail-Composer-suggestion) strong", { text: "Person A" }); +});