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>
59 lines
2.2 KiB
JavaScript
59 lines
2.2 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { manageMessages } from "@mail/js/tools/debug_manager";
|
|
import {
|
|
click,
|
|
getFixture,
|
|
legacyExtraNextTick,
|
|
patchWithCleanup,
|
|
} from "@web/../tests/helpers/utils";
|
|
import {
|
|
createWebClient,
|
|
doAction,
|
|
getActionManagerServerData,
|
|
} from "@web/../tests/webclient/helpers";
|
|
import { registry } from "@web/core/registry";
|
|
|
|
QUnit.module("debug menu");
|
|
|
|
QUnit.test("Manage Messages", async (assert) => {
|
|
patchWithCleanup(odoo, { debug: "1" });
|
|
const serverData = getActionManagerServerData();
|
|
// Add fake "mail.message" model and arch
|
|
serverData.models["mail.message"] = {
|
|
fields: { name: { string: "Name", type: "char" } },
|
|
records: [],
|
|
};
|
|
Object.assign(serverData.views, {
|
|
"mail.message,false,list": "<tree/>",
|
|
"mail.message,false,form": "<form/>",
|
|
"mail.message,false,search": "<search/>",
|
|
});
|
|
registry.category("debug").category("form").add("manageMessages", manageMessages);
|
|
async function mockRPC(route, { method, model, kwargs }) {
|
|
if (method === "check_access_rights") {
|
|
return true;
|
|
}
|
|
if (method === "web_search_read" && model === "mail.message") {
|
|
assert.step("message_read");
|
|
const { context, domain } = kwargs;
|
|
assert.strictEqual(context.default_res_id, 5);
|
|
assert.strictEqual(context.default_res_model, "partner");
|
|
assert.deepEqual(domain, ["&", ["res_id", "=", 5], ["model", "=", "partner"]]);
|
|
}
|
|
}
|
|
const target = getFixture();
|
|
const wc = await createWebClient({ serverData, mockRPC });
|
|
await doAction(wc, 3, { viewType: "form", props: { resId: 5 } });
|
|
await legacyExtraNextTick();
|
|
await click(target, ".o_debug_manager .dropdown-toggle");
|
|
const dropdownItems = target.querySelectorAll(".o_debug_manager .dropdown-menu .dropdown-item");
|
|
assert.strictEqual(dropdownItems.length, 1);
|
|
assert.strictEqual(dropdownItems[0].innerText.trim(), "Manage Messages");
|
|
|
|
await click(dropdownItems[0]);
|
|
await legacyExtraNextTick();
|
|
assert.verifySteps(["message_read"]);
|
|
assert.strictEqual($(".breadcrumb-item.active")[0].innerText.trim(), "Manage Messages");
|
|
});
|