+2








edd79ff560
*im_livechat,sms,snailmail Owl 2 changelog: https://github.com/odoo/owl/blob/a9f29c4caad4f32d06be1ec4780572825781cd9b/CHANGELOG.md Part-of: odoo/odoo#80156 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Bruno Boi <boi@odoo.com> Co-authored-by: Géry Debongnie <ged@odoo.com> Co-authored-by: Samuel Degueldre <sad@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Simon Genin (ges) <ges@odoo.com> Co-authored-by: Francois (fge) <fge@odoo.com> Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: luvi <luvi@odoo.com> Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
64 lines
2.2 KiB
JavaScript
64 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("DebugMenu");
|
|
|
|
QUnit.test("Manage Messages", async function (assert) {
|
|
assert.expect(6);
|
|
|
|
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, args) {
|
|
if (args.method === "check_access_rights") {
|
|
return true;
|
|
}
|
|
if (route === "/web/dataset/search_read" && args.model === "mail.message") {
|
|
assert.strictEqual(args.context.default_res_id, 5);
|
|
assert.strictEqual(args.context.default_res_model, "partner");
|
|
assert.deepEqual(args.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",
|
|
"should have correct menu item text"
|
|
);
|
|
|
|
await click(dropdownItems[0]);
|
|
await legacyExtraNextTick();
|
|
|
|
assert.strictEqual(
|
|
target.querySelector(".breadcrumb-item.active").innerText.trim(),
|
|
"Manage Messages"
|
|
);
|
|
});
|