mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
e7f4470d9c
* SDA-2547 - Upgrade electron version to 14.0.1
* SDA-2547 - refactor and fix unit tests
* SDA-2555 - Move custom title bar away from remote module
* SDA-2555 - Update API new-window to setWindowOpenHandler and fix issues
* SDA-2555 - Arrange imports
* SDA-2555 - Fix unit tests
* SDA-3387 - Fixed reload, native notification issues & finally removed the SFE CSS injection 🎉
* SDA-2547 - Fix fullscreen state on Windows
* SDA-2552 - Update version info
* SDA-2548 - Fix media permission
* SDA-2547 - Get app name from package.json
83 lines
1.8 KiB
TypeScript
83 lines
1.8 KiB
TypeScript
import { handleChildWindow } from '../src/app/child-window-handler';
|
|
import { webContents } from './__mocks__/electron';
|
|
import anything = jasmine.anything;
|
|
|
|
const getMainWindow = {
|
|
isDestroyed: jest.fn(() => false),
|
|
getBounds: jest.fn(() => {
|
|
return {
|
|
x: 11,
|
|
y: 22,
|
|
};
|
|
}),
|
|
isAlwaysOnTop: jest.fn(() => true),
|
|
setMenuBarVisibility: jest.fn(),
|
|
setAlwaysOnTop: jest.fn(),
|
|
setFullScreenable: jest.fn(),
|
|
};
|
|
|
|
jest.mock('electron-log');
|
|
|
|
jest.mock('../src/common/env', () => {
|
|
return {
|
|
isWindowsOS: true,
|
|
isLinux: false,
|
|
isMac: false,
|
|
};
|
|
});
|
|
|
|
jest.mock('../src/app/window-utils', () => {
|
|
return {
|
|
injectStyles: jest.fn(),
|
|
preventWindowNavigation: jest.fn(),
|
|
};
|
|
});
|
|
|
|
jest.mock('../src/app/window-handler', () => {
|
|
return {
|
|
windowHandler: {
|
|
url: 'https://test.symphony.com',
|
|
getMainWindow: jest.fn(() => {
|
|
return getMainWindow;
|
|
}),
|
|
openUrlInDefaultBrowser: jest.fn(),
|
|
addWindow: jest.fn(),
|
|
},
|
|
};
|
|
});
|
|
|
|
jest.mock('../src/app/window-actions', () => {
|
|
return {
|
|
monitorWindowActions: jest.fn(),
|
|
};
|
|
});
|
|
|
|
jest.mock('../src/common/logger', () => {
|
|
return {
|
|
logger: {
|
|
setLoggerWindow: jest.fn(),
|
|
error: jest.fn(),
|
|
warn: jest.fn(),
|
|
info: jest.fn(),
|
|
verbose: jest.fn(),
|
|
debug: jest.fn(),
|
|
silly: jest.fn(),
|
|
},
|
|
};
|
|
});
|
|
|
|
describe('child window handle', () => {
|
|
it('should set open window handler', () => {
|
|
const spy = jest.spyOn(webContents, 'setWindowOpenHandler');
|
|
|
|
handleChildWindow(webContents as any);
|
|
expect(spy).toBeCalledWith(expect.any(Function));
|
|
});
|
|
|
|
it('should trigger did-create-window', () => {
|
|
const spy = jest.spyOn(webContents, 'on');
|
|
handleChildWindow(webContents as any);
|
|
expect(spy).toBeCalledWith('did-create-window', anything());
|
|
});
|
|
});
|