Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit committed Nov 13, 2024
1 parent ae347bb commit 51c3de3
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 3 deletions.
67 changes: 66 additions & 1 deletion packages/compass/src/main/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ describe('CompassMenu', function () {
]);
});

['linux', 'win32'].forEach((platform) => {
// TODO(COMPASS-XXXX): Add `linux` back to this list
['win32'].forEach((platform) => {
// TODO(COMPASS-7906): remove
it.skip(`[single-connection] should generate a menu template for ${platform}`, function () {
sinon.stub(process, 'platform').value(platform);
Expand Down Expand Up @@ -588,6 +589,70 @@ describe('CompassMenu', function () {
});
});

// TODO(COMPASS-XXXX): Remove this test
it('should generate a menu template for linux', async function () {
await App.preferences.savePreferences({
enableMultipleConnectionSystem: true,
});
sinon.stub(process, 'platform').value('linux');

expect(serializable(CompassMenu.getTemplate(0))).to.deep.equal([
{
label: '&Connections',
submenu: [
{ label: '&Import Saved Connections' },
{ label: '&Export Saved Connections' },
{ type: 'separator' },
{ label: 'E&xit' },
],
},
{
label: 'Edit',
submenu: [
{ label: 'Undo', role: 'undo' },
{ label: 'Redo', role: 'redo' },
{ type: 'separator' },
{ label: 'Cut', role: 'cut' },
{ label: 'Copy', role: 'copy' },
{ label: 'Paste', role: 'paste' },
{
label: 'Select All',
role: 'selectAll',
},
{ type: 'separator' },
{ label: 'Find' },
{ type: 'separator' },
{ label: '&Settings' },
],
},
{
label: '&View',
submenu: [
{ label: '&Reload' },
{ label: '&Reload Data' },
{ type: 'separator' },
{ label: 'Actual Size' },
{ label: 'Zoom In' },
{ label: 'Zoom Out' },
],
},
{
label: '&Help',
submenu: [
{ label: `&Online ${app.getName()} Help` },
{ label: '&License' },
{ label: `&View Source Code on GitHub` },
{ label: `&Suggest a Feature` },
{ label: `&Report a Bug` },
{ label: '&Open Log File' },
{ type: 'separator' },
{ label: `&About ${app.getName()}` },
{ label: 'Check for updates…' },
],
},
]);
});

it('should generate a menu template without collection submenu if `showCollection` is `false`', function () {
expect(
CompassMenu.getTemplate(0).find((item) => item.label === '&Collection')
Expand Down
3 changes: 1 addition & 2 deletions packages/compass/src/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,7 @@ class CompassMenu {
return darwinMenu(menuState, this.app);
}
const menu = nonDarwinMenu(menuState, this.app);
// Currently on Linux, the menu accelerators crash the app and while
// fix is out, we are removing the accelerators from the all menu items.
// TODO(COMPASS-XXXX): Remove this check once accelerator issue is resolve for linux.
if (os.platform() === 'linux') {
return removeAcceleratorFromMenu(menu);
}
Expand Down

0 comments on commit 51c3de3

Please sign in to comment.