This commit refactors discuss code to use OWL components and new tools and services in web/. Functionally, Discuss app should work relatively the same as before this commit. closes https://github.com/odoo/odoo/pull/110188 Related: https://github.com/odoo/enterprise/pull/38058 https://github.com/odoo/upgrade/pull/4423 closes odoo/odoo#110188 Related: odoo/upgrade#4423 Related: odoo/enterprise#38058 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre (aku) <aku@odoo.com> Co-authored-by: Didier (did) <did@odoo.com> Co-authored-by: Géry (ged) <ged@odoo.com> Co-authored-by: Louis (wil) <wil@odoo.com> Co-authored-by: Maël (mapa) <mapa@odoo.com> Co-authored-by: Maryam (maki) <maki@odoo.com> Co-authored-by: Sébastien (seb) <seb@odoo.com> Co-authored-by: Thanh (tso) <tso@odoo.com> Co-authored-by: Matthieu (tsm) <tsm@odoo.com> Co-authored-by: Zelong (zel) <zel@odoo.com>
72 lines
2.8 KiB
JavaScript
72 lines
2.8 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { startServer, start, click } from "@mail/../tests/helpers/test_utils";
|
|
import { makeDeferred, patchWithCleanup } from "@web/../tests/helpers/utils";
|
|
|
|
QUnit.module("message (patch)");
|
|
|
|
QUnit.test("Notification Sent", async (assert) => {
|
|
const pyEnv = await startServer();
|
|
const partnerId = pyEnv["res.partner"].create({ name: "Someone", partner_share: true });
|
|
const messageId = pyEnv["mail.message"].create({
|
|
body: "not empty",
|
|
message_type: "sms",
|
|
model: "res.partner",
|
|
res_id: partnerId,
|
|
});
|
|
pyEnv["mail.notification"].create({
|
|
mail_message_id: messageId,
|
|
notification_status: "sent",
|
|
notification_type: "sms",
|
|
res_partner_id: partnerId,
|
|
});
|
|
const { openFormView } = await start();
|
|
await openFormView("res.partner", partnerId);
|
|
assert.containsOnce($, ".o-mail-Message");
|
|
assert.containsOnce($, ".o-mail-Message-notification");
|
|
assert.containsOnce($, ".o-mail-Message-notification i");
|
|
assert.hasClass($(".o-mail-Message-notification i"), "fa-mobile");
|
|
|
|
await click(".o-mail-Message-notification");
|
|
assert.containsOnce($, ".o-mail-MessageNotificationPopover");
|
|
assert.containsOnce($, ".o-mail-MessageNotificationPopover i");
|
|
assert.hasClass($(".o-mail-MessageNotificationPopover i"), "fa-check");
|
|
assert.containsOnce($, ".o-mail-MessageNotificationPopover:contains(Someone)");
|
|
});
|
|
|
|
QUnit.test("Notification Error", async (assert) => {
|
|
const openResendActionDef = makeDeferred();
|
|
const pyEnv = await startServer();
|
|
const partnerId = pyEnv["res.partner"].create({ name: "Someone", partner_share: true });
|
|
const messageId = pyEnv["mail.message"].create({
|
|
body: "not empty",
|
|
message_type: "sms",
|
|
model: "res.partner",
|
|
res_id: partnerId,
|
|
});
|
|
pyEnv["mail.notification"].create({
|
|
mail_message_id: messageId,
|
|
notification_status: "exception",
|
|
notification_type: "sms",
|
|
res_partner_id: partnerId,
|
|
});
|
|
const { env, openFormView } = await start();
|
|
await openFormView("res.partner", partnerId);
|
|
patchWithCleanup(env.services.action, {
|
|
doAction(action, options) {
|
|
assert.step("do_action");
|
|
assert.strictEqual(action, "sms.sms_resend_action");
|
|
assert.strictEqual(options.additionalContext.default_mail_message_id, messageId);
|
|
openResendActionDef.resolve();
|
|
},
|
|
});
|
|
|
|
assert.containsOnce($, ".o-mail-Message");
|
|
assert.containsOnce($, ".o-mail-Message-notification");
|
|
assert.containsOnce($, ".o-mail-Message-notification i");
|
|
assert.hasClass($(".o-mail-Message-notification i"), "fa-mobile");
|
|
click(".o-mail-Message-notification").catch(() => {});
|
|
await openResendActionDef;
|
|
assert.verifySteps(["do_action"]);
|
|
});
|