Hide title bar on macOS
This commit is contained in:
37
ts/test-node/util/toggleMaximizedBrowserWindow_test.ts
Normal file
37
ts/test-node/util/toggleMaximizedBrowserWindow_test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as sinon from 'sinon';
|
||||
import { BrowserWindow } from 'electron';
|
||||
|
||||
import { toggleMaximizedBrowserWindow } from '../../util/toggleMaximizedBrowserWindow';
|
||||
|
||||
describe('toggleMaximizedBrowserWindow', () => {
|
||||
const createFakeWindow = () => ({
|
||||
isMaximized: sinon.stub(),
|
||||
unmaximize: sinon.spy(),
|
||||
maximize: sinon.spy(),
|
||||
});
|
||||
|
||||
it('maximizes an unmaximized window', () => {
|
||||
const browserWindow = createFakeWindow();
|
||||
browserWindow.isMaximized.returns(false);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
toggleMaximizedBrowserWindow((browserWindow as any) as BrowserWindow);
|
||||
|
||||
sinon.assert.calledOnce(browserWindow.maximize);
|
||||
sinon.assert.notCalled(browserWindow.unmaximize);
|
||||
});
|
||||
|
||||
it('unmaximizes a maximized window', () => {
|
||||
const browserWindow = createFakeWindow();
|
||||
browserWindow.isMaximized.returns(true);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
toggleMaximizedBrowserWindow((browserWindow as any) as BrowserWindow);
|
||||
|
||||
sinon.assert.notCalled(browserWindow.maximize);
|
||||
sinon.assert.calledOnce(browserWindow.unmaximize);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user