fix: don't restore maximized BrowserWindow when calling showInactive (#32870)

This commit is contained in:
David Sanders 2022-02-21 01:23:55 -08:00 committed by GitHub
parent bdad6335c4
commit 069cde09fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 0 deletions

View file

@ -735,6 +735,22 @@ describe('BrowserWindow module', () => {
w.showInactive();
expect(w.isFocused()).to.equal(false);
});
// TODO(dsanders11): Enable for Linux once CI plays nice with these kinds of tests
ifit(process.platform !== 'linux')('should not restore maximized windows', async () => {
const maximize = emittedOnce(w, 'maximize');
const shown = emittedOnce(w, 'show');
w.maximize();
// TODO(dsanders11): The maximize event isn't firing on macOS for a window initially hidden
if (process.platform !== 'darwin') {
await maximize;
} else {
await delay(1000);
}
w.showInactive();
await shown;
expect(w.isMaximized()).to.equal(true);
});
});
describe('BrowserWindow.focus()', () => {