add hide on start option (#1919)

* add hide on start option (#1918)

* text update

* clean up

* removed `hideOnStart` from ConfigV1 & ConfigV2

* tests update
This commit is contained in:
Profesor08
2021-12-13 16:19:59 +02:00
committed by GitHub
parent fca6a75ee4
commit a410222e14
9 changed files with 55 additions and 3 deletions

View File

@@ -162,11 +162,28 @@ describe('main/windows/mainWindow', () => {
};
BrowserWindow.mockImplementation(() => window);
fs.readFileSync.mockImplementation(() => '{"x":400,"y":300,"width":1280,"height":700,"maximized":true,"fullscreen":false}');
Config.hideOnStart = false;
createMainWindow({});
expect(window.webContents.zoomLevel).toStrictEqual(0);
expect(window.maximize).toBeCalled();
});
it('should not show window on ready-to-show', () => {
const window = {
...baseWindow,
once: jest.fn().mockImplementation((event, cb) => {
if (event === 'ready-to-show') {
cb();
}
}),
};
BrowserWindow.mockImplementation(() => window);
fs.readFileSync.mockImplementation(() => '{"x":400,"y":300,"width":1280,"height":700,"maximized":true,"fullscreen":false}');
Config.hideOnStart = true;
createMainWindow({});
expect(window.show).not.toHaveBeenCalled();
});
it('should save window state on close if the app will quit', () => {
global.willAppQuit = true;
const window = {