Fix tray icon always on (regression from #1235)

This commit is contained in:
Adam Weeden 2021-06-22 19:09:11 -04:00 committed by GitHub
parent a491e34966
commit d69d4b253a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View File

@ -9,7 +9,7 @@ export function createTrayIcon(
): Tray {
const options = { ...nativefierOptions };
if (options.tray) {
if (options.tray && options.tray !== 'false') {
const iconPath = getAppIcon();
const nimage = nativeImage.createFromPath(iconPath);
const appIcon = new Tray(nativeImage.createEmpty());

View File

@ -309,23 +309,22 @@ describe('initArgs + parseArgs', () => {
{ arg: 'tray', value: 'false' },
{ arg: 'tray', value: 'start-in-tray' },
{ arg: 'tray', value: '' },
{ arg: 'tray', value: undefined },
])('test tray valyue %s', ({ arg, value }) => {
if (value !== undefined) {
const args = parseArgs(
initArgs(['https://google.com', `--${arg}`, `${value}`]),
) as Record<string, number>;
if (value !== '') {
expect(args[arg]).toBe(value);
} else {
expect(args[arg]).toBe('true');
}
const args = parseArgs(
initArgs(['https://google.com', `--${arg}`, `${value}`]),
) as Record<string, number>;
if (value !== '') {
expect(args[arg]).toBe(value);
} else {
const args = parseArgs(initArgs(['https://google.com'])) as Record<
string,
number
>;
expect(args[arg]).toBe('false');
expect(args[arg]).toBe('true');
}
});
test('test tray value defaults to false', () => {
const args = parseArgs(initArgs(['https://google.com'])) as Record<
string,
number
>;
expect(args.tray).toBe('false');
});
});