From 852e158cc60df8730efdee46848f185e0a653990 Mon Sep 17 00:00:00 2001 From: CharlieHess Date: Thu, 26 Jan 2017 12:35:46 -0800 Subject: [PATCH] Make sure the spec takes arguments into account. --- docs/api/app.md | 3 +++ spec/api-app-spec.js | 15 ++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 657cf0255fbb..f88bc4c64759 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -765,6 +765,9 @@ Returns `Boolean` - Whether the current desktop environment is Unity launcher. * `args` String[] (optional) _Windows_ - The command-line arguments to compare against. Defaults to an empty array. +If you provided arguments to `app.setLoginItemSettings` you need to pass the +same arguments here for `openAtLogin` to be set correctly. + Returns `Object`: * `openAtLogin` Boolean - `true` if the app is set to open at login. diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index 0d8c3a37ff12..5ad2a69481ee 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -357,18 +357,15 @@ describe('app module', function () { const updateExe = path.resolve(appFolder, '..', 'Update.exe') const exeName = path.basename(process.execPath) - app.setLoginItemSettings({openAtLogin: true}, updateExe, [ + const processStartArgs = [ '--processStart', `"${exeName}"`, '--process-start-args', `"--hidden"` - ]) + ]; - assert.deepEqual(app.getLoginItemSettings(), { - openAtLogin: true, - openAsHidden: false, - wasOpenedAtLogin: false, - wasOpenedAsHidden: false, - restoreState: false - }) + app.setLoginItemSettings({openAtLogin: true}, updateExe, processStartArgs) + + assert(!app.getLoginItemSettings().openAtLogin) + assert(app.getLoginItemSettings(updateExe, processStartArgs)) }) })