2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-06-01 12:20:48 +00:00

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 { ): Tray {
const options = { ...nativefierOptions }; const options = { ...nativefierOptions };
if (options.tray) { if (options.tray && options.tray !== 'false') {
const iconPath = getAppIcon(); const iconPath = getAppIcon();
const nimage = nativeImage.createFromPath(iconPath); const nimage = nativeImage.createFromPath(iconPath);
const appIcon = new Tray(nativeImage.createEmpty()); const appIcon = new Tray(nativeImage.createEmpty());

View File

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