From 577041f722590aadf3b75a504a03536b9e3413f6 Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Wed, 29 May 2024 14:56:29 +0200 Subject: [PATCH] fix(menu-builder): remove new file options from tab menu closes #4181 --- app/lib/menu/menu-builder.js | 8 ++------ app/test/spec/menu/menu-builder-spec.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/lib/menu/menu-builder.js b/app/lib/menu/menu-builder.js index cce97fa7a1..59d88e2fcf 100644 --- a/app/lib/menu/menu-builder.js +++ b/app/lib/menu/menu-builder.js @@ -94,13 +94,9 @@ class MenuBuilder { const { contextMenu } = this.options.state; if (this.options.type === 'tab') { - return this.appendNewFile() + return this.appendContextCloseTab() .appendSeparator() - .appendContextCloseTab() - .appendSeparator() - .appendContextRevealInFileExplorerTab() - .appendSeparator() - .appendOpenRecent(); + .appendContextRevealInFileExplorerTab(); } if (contextMenu) { diff --git a/app/test/spec/menu/menu-builder-spec.js b/app/test/spec/menu/menu-builder-spec.js index 36eb183905..fdd4c80e04 100644 --- a/app/test/spec/menu/menu-builder-spec.js +++ b/app/test/spec/menu/menu-builder-spec.js @@ -67,6 +67,13 @@ describe('MenuBuilder', () => { const contextMenu = menuBuilder.buildContextMenu(); expect(contextMenu).to.exist; + expectMenu(contextMenu, [ + 'Close Tab', + 'Close All Tabs', + 'Close Other Tabs', + undefined, + 'Reveal in File Explorer' + ]); }); @@ -532,3 +539,9 @@ function callAction(fn, browserWindow = {}, triggeredByAccelerator = false) { return fn(null, browserWindow, { triggeredByAccelerator }); } + +function expectMenu(actual, expected) { + const menu = actual.menu.map(item => item.label); + + expect(menu).to.eql(expected); +} \ No newline at end of file