mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 08:51:42 +00:00
fix(ui): hide group submenu separator when New group is the only entry (#104370)
This commit is contained in:
committed by
GitHub
parent
ef95c5d74e
commit
aeab8e7faf
@@ -174,6 +174,33 @@ describe("session menu", () => {
|
||||
expect(menuItemLabels(menu)).not.toContain("Remove from group");
|
||||
});
|
||||
|
||||
it("omits the submenu separator when New group is the only entry", async () => {
|
||||
const menu = await mountMenu({ groups: [] });
|
||||
|
||||
menuItem(menu, "Move to group").click();
|
||||
await menu.updateComplete;
|
||||
|
||||
const submenu = menu.querySelector<HTMLElement>(".session-menu__submenu");
|
||||
if (!submenu) {
|
||||
throw new Error("Expected group submenu");
|
||||
}
|
||||
expect(menuItemLabels(submenu)).toEqual(["New group…"]);
|
||||
expect(submenu.querySelector('[role="separator"]')).toBeNull();
|
||||
});
|
||||
|
||||
it("keeps the submenu separator when groups exist", async () => {
|
||||
const menu = await mountMenu({ groups: ["Research"] });
|
||||
|
||||
menuItem(menu, "Move to group").click();
|
||||
await menu.updateComplete;
|
||||
|
||||
const submenu = menu.querySelector<HTMLElement>(".session-menu__submenu");
|
||||
if (!submenu) {
|
||||
throw new Error("Expected group submenu");
|
||||
}
|
||||
expect(submenu.querySelector('[role="separator"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
it("numbers group submenu entries and dispatches them from digit keys", async () => {
|
||||
const onAction = vi.fn<(action: SessionMenuAction) => void>();
|
||||
const menu = await mountMenu({
|
||||
|
||||
@@ -268,7 +268,9 @@ class SessionMenu extends OpenClawLightDomElement {
|
||||
category: null,
|
||||
})
|
||||
: nothing}
|
||||
<div class="session-menu__separator" role="separator"></div>
|
||||
${this.groups.length > 0 || session.category
|
||||
? html`<div class="session-menu__separator" role="separator"></div>`
|
||||
: nothing}
|
||||
${entry(t("sessionsView.newGroup"), false, { kind: "new-group" })}
|
||||
</div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user