Files
odoo_source/addons/mail/static/tests/web/command_palette_tests.js
T
7710c3331e [REF] mail, *: refactor Discuss
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>
2023-03-17 11:47:09 +01: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["mail.channel"].create({ name: "general" });
pyEnv["mail.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)");
});