|
@@ -1,4 +1,5 @@
|
|
|
const { remote } = require('electron')
|
|
|
+const assert = require('assert')
|
|
|
const { Menu, Tray, nativeImage } = remote
|
|
|
|
|
|
describe('tray module', () => {
|
|
@@ -8,12 +9,12 @@ describe('tray module', () => {
|
|
|
tray = new Tray(nativeImage.createEmpty())
|
|
|
})
|
|
|
|
|
|
- afterEach(() => {
|
|
|
- tray.destroy()
|
|
|
- tray = null
|
|
|
- })
|
|
|
-
|
|
|
describe('tray.setContextMenu', () => {
|
|
|
+ afterEach(() => {
|
|
|
+ tray.destroy()
|
|
|
+ tray = null
|
|
|
+ })
|
|
|
+
|
|
|
it('accepts menu instance', () => {
|
|
|
tray.setContextMenu(new Menu())
|
|
|
})
|
|
@@ -23,7 +24,22 @@ describe('tray module', () => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ describe('tray.destroy()', () => {
|
|
|
+ it('destroys a tray', () => {
|
|
|
+ assert.strictEqual(tray.isDestroyed(), false)
|
|
|
+ tray.destroy()
|
|
|
+
|
|
|
+ assert.strictEqual(tray.isDestroyed(), true)
|
|
|
+ tray = null
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
describe('tray.popUpContextMenu', () => {
|
|
|
+ afterEach(() => {
|
|
|
+ tray.destroy()
|
|
|
+ tray = null
|
|
|
+ })
|
|
|
+
|
|
|
before(function () {
|
|
|
if (process.platform !== 'win32') {
|
|
|
this.skip()
|
|
@@ -43,22 +59,31 @@ describe('tray module', () => {
|
|
|
describe('tray.setImage', () => {
|
|
|
it('accepts empty image', () => {
|
|
|
tray.setImage(nativeImage.createEmpty())
|
|
|
+
|
|
|
+ tray.destroy()
|
|
|
+ tray = null
|
|
|
})
|
|
|
})
|
|
|
|
|
|
describe('tray.setPressedImage', () => {
|
|
|
it('accepts empty image', () => {
|
|
|
tray.setPressedImage(nativeImage.createEmpty())
|
|
|
+
|
|
|
+ tray.destroy()
|
|
|
+ tray = null
|
|
|
})
|
|
|
})
|
|
|
|
|
|
describe('tray.setTitle', () => {
|
|
|
+ before(function () {
|
|
|
+ if (process.platform !== 'darwin') this.skip()
|
|
|
+ })
|
|
|
+
|
|
|
it('accepts non-empty string', () => {
|
|
|
tray.setTitle('Hello World!')
|
|
|
- })
|
|
|
|
|
|
- it('accepts empty string', () => {
|
|
|
- tray.setTitle('')
|
|
|
+ tray.destroy()
|
|
|
+ tray = null
|
|
|
})
|
|
|
})
|
|
|
})
|