fix: stop menu minimization if set false (#46714)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
This commit is contained in:
parent
07a7ebb714
commit
11c820c537
2 changed files with 20 additions and 2 deletions
|
@ -2,7 +2,7 @@ import { BrowserWindow, app, Menu, MenuItem, MenuItemConstructorOptions } from '
|
|||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { ifdescribe } from './lib/spec-helpers';
|
||||
import { ifit, ifdescribe } from './lib/spec-helpers';
|
||||
import { closeAllWindows } from './lib/window-helpers';
|
||||
import { roleList, execute } from '../lib/browser/api/menu-item-roles';
|
||||
|
||||
|
@ -205,6 +205,22 @@ describe('MenuItems', () => {
|
|||
const canExecute = execute(item.role as any, win, win.webContents);
|
||||
expect(canExecute).to.be.true('can execute');
|
||||
});
|
||||
|
||||
ifit(process.platform === 'win32')('does not execute minimize role when minimizable false', () => {
|
||||
const win = new BrowserWindow({ minimizable: false });
|
||||
const menu = Menu.buildFromTemplate([{
|
||||
label: 'text',
|
||||
role: 'minimize'
|
||||
}]);
|
||||
|
||||
Menu.setApplicationMenu(menu);
|
||||
menu._executeCommand({}, menu.items[0].commandId);
|
||||
expect(win.isMinimized()).to.equal(false);
|
||||
|
||||
win.setMinimizable(true);
|
||||
menu._executeCommand({}, menu.items[0].commandId);
|
||||
expect(win.isMinimized()).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('MenuItem command id', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue