Files
odoo_source/addons/mail/static/tests/web/command_palette_tests.js
T
Sébastien Theys 90cb44e1e1 [REF] mail, *: rename mail.channel to discuss.channel
* = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot,
    mass_mailing, privacy_lookup, test_discuss_full, test_mail,
    test_mail_full, website_crm_livechat, website_livechat, base

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#118354

Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-21 02:21:53 +02:00

47 lines
1.9 KiB
JavaScript

/** @odoo-module **/
import { editSearchBar } from "@web/../tests/core/commands/command_service_tests";
import { afterNextRender, click, start, startServer } from "@mail/../tests/helpers/test_utils";
import { nextTick, triggerHotkey } from "@web/../tests/helpers/utils";
import { registry } from "@web/core/registry";
import { commandService } from "@web/core/commands/command_service";
const serviceRegistry = registry.category("services");
const commandSetupRegistry = registry.category("command_setup");
QUnit.module("command palette", {
async beforeEach() {
serviceRegistry.add("command", commandService);
registry.category("command_categories").add("default", { label: "default" });
},
});
QUnit.test("open the chatWindow of a user from the command palette", async (assert) => {
const { advanceTime } = await start({ hasTimeControl: true });
triggerHotkey("control+k");
await nextTick();
// Switch to partners
await editSearchBar("@");
await afterNextRender(() => advanceTime(commandSetupRegistry.get("@").debounceDelay));
await click(".o_command.focused");
assert.containsOnce($, ".o-mail-ChatWindow");
});
QUnit.test("open the chatWindow of a channel from the command palette", async (assert) => {
const pyEnv = await startServer();
pyEnv["discuss.channel"].create({ name: "general" });
pyEnv["discuss.channel"].create({ name: "project" });
const { advanceTime } = await start({ hasTimeControl: true });
triggerHotkey("control+k");
await nextTick();
// Switch to channels
await editSearchBar("#");
await afterNextRender(() => advanceTime(commandSetupRegistry.get("#").debounceDelay));
assert.containsOnce($, ".o_command:contains(general)");
assert.containsOnce($, ".o_command:contains(project)");
await click(".o_command.focused");
assert.containsOnce($, ".o-mail-ChatWindow");
assert.containsOnce($, ".o-mail-ChatWindow-name:contains(general)");
});