[FIX] web: navbar: set action id in menu href
Before this commit, the href attribute of menu elements didn't contain the "action=xx" part but only the id of the menu. closes odoo/odoo#87570 X-original-commit: 6b8242ee1918b784dfdb2160cca6df1c165a824b Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
committed by
Aaron Bohy
parent
f6a9c2868c
commit
c31423a756
@@ -180,8 +180,8 @@ export class NavBar extends Component {
|
||||
|
||||
getMenuItemHref(payload) {
|
||||
const parts = [`menu_id=${payload.id}`];
|
||||
if (payload.action) {
|
||||
parts.push(`action=${payload.action.split(",")[1]}`);
|
||||
if (payload.actionID) {
|
||||
parts.push(`action=${payload.actionID}`);
|
||||
}
|
||||
return "#" + parts.join("&");
|
||||
}
|
||||
|
||||
@@ -70,6 +70,19 @@ QUnit.test("dropdown menu can be toggled", async (assert) => {
|
||||
assert.containsNone(dropdown, ".dropdown-menu");
|
||||
});
|
||||
|
||||
QUnit.test("href attribute on apps menu items", async (assert) => {
|
||||
baseConfig.serverData.menus = {
|
||||
root: { id: "root", children: [1], name: "root", appID: "root" },
|
||||
1: { id: 1, children: [2], name: "My app", appID: 1, actionID: 339 },
|
||||
};
|
||||
const env = await makeTestEnv(baseConfig);
|
||||
await mount(NavBar, target, { env });
|
||||
const appsMenu = target.querySelector(".o_navbar_apps_menu");
|
||||
await click(appsMenu, "button.dropdown-toggle");
|
||||
const dropdownItem = target.querySelector(".o_navbar_apps_menu .dropdown-item");
|
||||
assert.strictEqual(dropdownItem.getAttribute("href"), "#menu_id=1&action=339");
|
||||
});
|
||||
|
||||
QUnit.test("data-menu-xmlid attribute on AppsMenu items", async (assert) => {
|
||||
baseConfig.serverData.menus = {
|
||||
root: { id: "root", children: [1, 2], name: "root", appID: "root" },
|
||||
|
||||
Reference in New Issue
Block a user