mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 04:09:49 +00:00
Show window titlebar in test
This commit is contained in:
19
main.js
19
main.js
@@ -120,7 +120,7 @@ const {
|
|||||||
getTitleBarVisibility,
|
getTitleBarVisibility,
|
||||||
TitleBarVisibility,
|
TitleBarVisibility,
|
||||||
} = require('./ts/types/Settings');
|
} = require('./ts/types/Settings');
|
||||||
const { Environment } = require('./ts/environment');
|
const { Environment, isTestEnvironment } = require('./ts/environment');
|
||||||
const { ChallengeMainHandler } = require('./ts/main/challengeMain');
|
const { ChallengeMainHandler } = require('./ts/main/challengeMain');
|
||||||
const { NativeThemeNotifier } = require('./ts/main/NativeThemeNotifier');
|
const { NativeThemeNotifier } = require('./ts/main/NativeThemeNotifier');
|
||||||
const { PowerChannel } = require('./ts/main/powerChannel');
|
const { PowerChannel } = require('./ts/main/powerChannel');
|
||||||
@@ -362,13 +362,13 @@ async function createWindow() {
|
|||||||
minHeight: MIN_HEIGHT,
|
minHeight: MIN_HEIGHT,
|
||||||
autoHideMenuBar: false,
|
autoHideMenuBar: false,
|
||||||
titleBarStyle:
|
titleBarStyle:
|
||||||
getTitleBarVisibility() === TitleBarVisibility.Hidden
|
getTitleBarVisibility() === TitleBarVisibility.Hidden &&
|
||||||
|
!isTestEnvironment(config.environment)
|
||||||
? 'hidden'
|
? 'hidden'
|
||||||
: 'default',
|
: 'default',
|
||||||
backgroundColor:
|
backgroundColor: isTestEnvironment(config.environment)
|
||||||
config.environment === 'test' || config.environment === 'test-lib'
|
? '#ffffff' // Tests should always be rendered on a white background
|
||||||
? '#ffffff' // Tests should always be rendered on a white background
|
: '#3a76f0',
|
||||||
: '#3a76f0',
|
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
...defaultWebPrefs,
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
@@ -518,8 +518,7 @@ async function createWindow() {
|
|||||||
});
|
});
|
||||||
// If the application is terminating, just do the default
|
// If the application is terminating, just do the default
|
||||||
if (
|
if (
|
||||||
config.environment === 'test' ||
|
isTestEnvironment(config.environment) ||
|
||||||
config.environment === 'test-lib' ||
|
|
||||||
(mainWindow.readyForShutdown && windowState.shouldQuit())
|
(mainWindow.readyForShutdown && windowState.shouldQuit())
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@@ -1478,9 +1477,7 @@ app.on('window-all-closed', () => {
|
|||||||
// On OS X it is common for applications and their menu bar
|
// On OS X it is common for applications and their menu bar
|
||||||
// to stay active until the user quits explicitly with Cmd + Q
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||||
const shouldAutoClose =
|
const shouldAutoClose =
|
||||||
!OS.isMacOS() ||
|
!OS.isMacOS() || isTestEnvironment(config.environment);
|
||||||
config.environment === 'test' ||
|
|
||||||
config.environment === 'test-lib';
|
|
||||||
|
|
||||||
// Only automatically quit if the main window has been created
|
// Only automatically quit if the main window has been created
|
||||||
// This is necessary because `window-all-closed` can be triggered by the
|
// This is necessary because `window-all-closed` can be triggered by the
|
||||||
|
|||||||
@@ -39,3 +39,6 @@ export const parseEnvironment = makeEnumParser(
|
|||||||
Environment,
|
Environment,
|
||||||
Environment.Production
|
Environment.Production
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const isTestEnvironment = (env: Environment): boolean =>
|
||||||
|
env === Environment.Test || env === Environment.TestLib;
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
|
||||||
import { parseEnvironment, Environment } from '../environment';
|
import {
|
||||||
|
Environment,
|
||||||
|
isTestEnvironment,
|
||||||
|
parseEnvironment,
|
||||||
|
} from '../environment';
|
||||||
|
|
||||||
describe('environment utilities', () => {
|
describe('environment utilities', () => {
|
||||||
describe('parseEnvironment', () => {
|
describe('parseEnvironment', () => {
|
||||||
@@ -38,4 +42,17 @@ describe('environment utilities', () => {
|
|||||||
assert.equal(parseEnvironment('test-lib'), Environment.TestLib);
|
assert.equal(parseEnvironment('test-lib'), Environment.TestLib);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isTestEnvironment', () => {
|
||||||
|
it('returns false for non-test environments', () => {
|
||||||
|
assert.isFalse(isTestEnvironment(Environment.Development));
|
||||||
|
assert.isFalse(isTestEnvironment(Environment.Production));
|
||||||
|
assert.isFalse(isTestEnvironment(Environment.Staging));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns true for test environments', () => {
|
||||||
|
assert.isTrue(isTestEnvironment(Environment.Test));
|
||||||
|
assert.isTrue(isTestEnvironment(Environment.TestLib));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user