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:
parent
a491e34966
commit
d69d4b253a
|
@ -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());
|
||||||
|
|
|
@ -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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user