When the wizard (new dialog) is opened on the burger menu item, the burger menu does not close. The burger menu appears on the wizard. It is fixed. Reproduction Steps -Installed project application -Reporting -> Burndown Chart task-2739646 closes odoo/odoo#90721 X-original-commit: 69821a67ca04d9aa5bb040d93e491c7f75b67232 Related: odoo/enterprise#27027 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
160 lines
5.2 KiB
JavaScript
160 lines
5.2 KiB
JavaScript
/** @odoo-module **/
|
|
import { click, legacyExtraNextTick } from "@web/../tests/helpers/utils";
|
|
import {
|
|
createWebClient,
|
|
doAction,
|
|
getActionManagerServerData,
|
|
} from "@web/../tests/webclient/helpers";
|
|
import { registry } from "@web/core/registry";
|
|
import { BurgerMenu } from "@web/webclient/burger_menu/burger_menu";
|
|
import { companyService } from "@web/webclient/company_service";
|
|
|
|
/**
|
|
* Note: The asserts are all based on document.body (instead of getFixture() by example) because
|
|
* the burger menu is porteled into the dom and is not part of the qunit fixture.
|
|
*/
|
|
|
|
let serverData;
|
|
|
|
const serviceRegistry = registry.category("services");
|
|
|
|
QUnit.module("Burger Menu", {
|
|
beforeEach() {
|
|
serverData = getActionManagerServerData();
|
|
|
|
serviceRegistry.add("company", companyService);
|
|
|
|
registry.category("systray").add("burger_menu", {
|
|
Component: BurgerMenu,
|
|
});
|
|
},
|
|
});
|
|
|
|
QUnit.test("Burger menu can be opened and closed", async (assert) => {
|
|
assert.expect(2);
|
|
|
|
await createWebClient({ serverData });
|
|
|
|
await click(document.body, ".o_mobile_menu_toggle");
|
|
assert.containsOnce(document.body, ".o_burger_menu");
|
|
|
|
await click(document.body, ".o_burger_menu_close");
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
});
|
|
|
|
QUnit.test("Burger Menu on an App", async (assert) => {
|
|
assert.expect(7);
|
|
|
|
serverData.menus[1].children = [99];
|
|
serverData.menus[99] = {
|
|
id: 99,
|
|
children: [],
|
|
name: "SubMenu",
|
|
appID: 1,
|
|
actionID: 1002,
|
|
xmlid: "",
|
|
webIconData: undefined,
|
|
webIcon: false,
|
|
};
|
|
|
|
await createWebClient({ serverData });
|
|
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
|
await legacyExtraNextTick();
|
|
await click(document.body, ".o_app:nth-of-type(2)");
|
|
await legacyExtraNextTick();
|
|
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
|
|
await click(document.body, ".o_mobile_menu_toggle");
|
|
assert.containsOnce(document.body, ".o_burger_menu");
|
|
assert.containsOnce(
|
|
document.body,
|
|
".o_burger_menu .o_burger_menu_app .o_menu_sections .dropdown-item"
|
|
);
|
|
assert.strictEqual(
|
|
document.body.querySelector(
|
|
".o_burger_menu .o_burger_menu_app .o_menu_sections .dropdown-item"
|
|
).textContent,
|
|
"SubMenu"
|
|
);
|
|
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
|
|
|
await click(document.body, ".o_burger_menu_topbar");
|
|
assert.doesNotHaveClass(
|
|
document.body.querySelector(".o_burger_menu_content"),
|
|
"o_burger_menu_dark"
|
|
);
|
|
|
|
await click(document.body, ".o_burger_menu_topbar");
|
|
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
|
});
|
|
|
|
QUnit.test("Burger Menu on an App without SubMenu", async (assert) => {
|
|
assert.expect(6);
|
|
|
|
await createWebClient({ serverData });
|
|
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
|
await legacyExtraNextTick();
|
|
await click(document.body, ".o_app:nth-of-type(2)");
|
|
await legacyExtraNextTick();
|
|
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
|
|
await click(document.body, ".o_mobile_menu_toggle");
|
|
assert.containsOnce(document.body, ".o_burger_menu");
|
|
assert.containsOnce(document.body, ".o_user_menu_mobile");
|
|
assert.containsOnce(document.body, ".o_burger_menu_user");
|
|
assert.containsNone(document.body, ".o_burger_menu_app");
|
|
await click(document.body, ".o_burger_menu_close");
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
});
|
|
|
|
QUnit.test("Burger menu closes when an action is requested", async (assert) => {
|
|
assert.expect(3);
|
|
|
|
const wc = await createWebClient({ serverData });
|
|
|
|
await click(document.body, ".o_mobile_menu_toggle");
|
|
assert.containsOnce(document.body, ".o_burger_menu");
|
|
|
|
await doAction(wc, 1);
|
|
await legacyExtraNextTick();
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
assert.containsOnce(document.body, ".o_kanban_view");
|
|
});
|
|
|
|
QUnit.test("Burger menu closes when click on menu item", async (assert) => {
|
|
serverData.actions[1].target = 'new';
|
|
serverData.menus[1].children = [99];
|
|
serverData.menus[99] = {
|
|
id: 99,
|
|
children: [],
|
|
name: "SubMenu",
|
|
appID: 1,
|
|
actionID: 1,
|
|
xmlid: "",
|
|
webIconData: undefined,
|
|
webIcon: false,
|
|
};
|
|
await createWebClient({ serverData });
|
|
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
|
await legacyExtraNextTick();
|
|
await click(document.body, ".o_app:nth-of-type(2)");
|
|
await legacyExtraNextTick();
|
|
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
|
|
await click(document.body, ".o_mobile_menu_toggle");
|
|
assert.containsOnce(document.body, ".o_burger_menu");
|
|
assert.strictEqual(
|
|
document.body.querySelector(
|
|
".o_burger_menu .o_burger_menu_app .o_menu_sections .dropdown-item"
|
|
).textContent,
|
|
"SubMenu"
|
|
);
|
|
await click(document.body, ".o_burger_menu .o_burger_menu_app .o_menu_sections .dropdown-item");
|
|
await legacyExtraNextTick();
|
|
await legacyExtraNextTick();
|
|
assert.containsNone(document.body, ".o_burger_menu");
|
|
});
|