Skip to content

Commit

Permalink
[REM] menu: remove icons on menu items
Browse files Browse the repository at this point in the history
This commit temporarilly disable icons on the left of menu items.
The reason is we don't have icons for *all* items. So some have an icon,
oters don't. This is weird.
When we will introduce icons for every menu items, we can revert this
commit.

closes #2046

Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
  • Loading branch information
LucasLefevre committed Apr 14, 2023
1 parent 54fca81 commit 4f2ecfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,10 @@ export class Menu extends Component<Props, SpreadsheetChildEnv> {
}

get childrenHaveIcon(): boolean {
return this.props.menuItems.some((menuItem) => !!menuItem.icon || !!menuItem.isActive);
return this.props.menuItems.some((menuItem) => !menuItem.icon && !!menuItem.isActive);
}

getIconName(menu: Action) {
if (menu.icon) {
return menu.icon;
}

if (menu.isActive?.(this.env)) {
return "o-spreadsheet-Icon.CHECK";
}
Expand Down
6 changes: 3 additions & 3 deletions tests/components/context_menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ describe("Context Menu internal tests", () => {
expect(fixture.querySelector(".o-menu div[data-name='subMenu']")).toBeTruthy();
});

test("Menu with icon is correctly displayed", async () => {
test("Menu with icon is not displayed", async () => {
const menuItems: Action[] = createActions([
{
id: "root1",
Expand All @@ -574,9 +574,9 @@ describe("Context Menu internal tests", () => {
},
]);
await renderContextMenu(300, 990, { menuItems });
expect(fixture.querySelector("div[data-name='root1'] svg")).not.toBeNull();
expect(fixture.querySelector("div[data-name='root1'] svg")).not.toBeNull(); // right caret
await simulateClick("div[data-name='root1']");
expect(fixture.querySelector("div[data-name='root2'] svg")).not.toBeNull();
expect(fixture.querySelector("div[data-name='root2'] svg")).toBeNull();
expect(fixture.querySelector("div[data-name='root3'] svg")).toBeNull();
});

Expand Down

0 comments on commit 4f2ecfe

Please sign in to comment.