Skip to content

Commit

Permalink
Remove Electron warning (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
poipoii authored and sindresorhus committed Jan 7, 2020
1 parent 785ec83 commit dde9016
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function registerListener(session, options, cb = () => {}) {
}, completedBytes);

if (options.showBadge && ['darwin', 'linux'].includes(process.platform)) {
app.setBadgeCount(activeDownloadItems());
app.badgeCount = activeDownloadItems();
}

if (!win.isDestroyed()) {
Expand All @@ -91,7 +91,7 @@ function registerListener(session, options, cb = () => {}) {
downloadItems.delete(item);

if (options.showBadge && ['darwin', 'linux'].includes(process.platform)) {
app.setBadgeCount(activeDownloadItems());
app.badgeCount = activeDownloadItems();
}

if (!win.isDestroyed() && !activeDownloadItems()) {
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('download a single file', async t => {
await client.waitForExist(`[data-unique-filename="${t.context.files[0]}"]`);
await client.click(`[data-unique-filename="${t.context.files[0]}"]`);

t.is(await t.context.spectron.electron.remote.app.getBadgeCount(), 1);
t.is(await t.context.spectron.electron.remote.app.badgeCount(), 1);
});

test('download a couple files', async t => {
Expand All @@ -45,6 +45,6 @@ test('download a couple files', async t => {
await client.click(`[data-unique-filename="${t.context.files[2]}"]`);

// The first download appears to finish before the second is added sometimes
const badgeCount = await t.context.spectron.electron.remote.app.getBadgeCount();
const badgeCount = await t.context.spectron.electron.remote.app.badgeCount();
t.true(badgeCount === 1 || badgeCount === 2);
});

0 comments on commit dde9016

Please sign in to comment.