From 9aa8807f83ac3eb16d82552ed0ebfe509838164c Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Wed, 29 Jun 2016 19:47:20 +0200 Subject: [PATCH] add specs for app.launcher api fix linter errors --- spec/api-app-spec.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index 6cda0e11bc0..214a084f2ec 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -284,4 +284,37 @@ describe('app module', function () { }) }) }) + + describe('app.launcher API', function () { + it('should be available on linux', function () { + if (process.platform !== 'linux') { + assert.equal(app.launcher, undefined) + } else { + assert.notEqual(app.launcher, undefined) + } + }) + + it('should be possible to set a badge count on supported environments', function () { + if (process.platform === 'linux' && + app.launcher.isCounterBadgeAvailable()) { + app.launcher.setBadgeCount(42) + assert.equal(app.launcher.getBadgeCount(), 42) + } + }) + + it('should be possible to set a badge count on unity', function () { + if (process.platform === 'linux' && + app.launcher.isUnityRunning()) { + assert.equal(app.launcher.isCounterBadgeAvailable(), true) + } + }) + + it('should not be possible to set a badge counter on unsupported environments', function () { + if (process.platform === 'linux' && + !app.launcher.isCounterBadgeAvailable()) { + app.launcher.setBadgeCount(42) + assert.equal(app.launcher.getBadgeCount(), 0) + } + }) + }) })