2018-09-13 16:10:51 +00:00
|
|
|
const { remote } = require('electron')
|
|
|
|
const { Menu, Tray, nativeImage } = remote
|
2018-08-27 16:58:47 +00:00
|
|
|
|
|
|
|
describe('tray module', () => {
|
2018-08-30 09:16:56 +00:00
|
|
|
let tray
|
2018-08-27 16:58:47 +00:00
|
|
|
|
2018-08-30 09:16:56 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
tray = new Tray(nativeImage.createEmpty())
|
|
|
|
})
|
2018-08-27 16:58:47 +00:00
|
|
|
|
2018-08-30 09:16:56 +00:00
|
|
|
afterEach(() => {
|
|
|
|
tray.destroy()
|
|
|
|
tray = null
|
|
|
|
})
|
2018-08-27 16:58:47 +00:00
|
|
|
|
2018-08-30 09:16:56 +00:00
|
|
|
describe('tray.setContextMenu', () => {
|
2018-08-27 16:58:47 +00:00
|
|
|
it('accepts menu instance', () => {
|
|
|
|
tray.setContextMenu(new Menu())
|
|
|
|
})
|
|
|
|
|
|
|
|
it('accepts null', () => {
|
|
|
|
tray.setContextMenu(null)
|
|
|
|
})
|
|
|
|
})
|
2018-08-30 09:16:56 +00:00
|
|
|
|
|
|
|
describe('tray.setImage', () => {
|
|
|
|
it('accepts empty image', () => {
|
|
|
|
tray.setImage(nativeImage.createEmpty())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('tray.setPressedImage', () => {
|
|
|
|
it('accepts empty image', () => {
|
|
|
|
tray.setPressedImage(nativeImage.createEmpty())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('tray.setTitle', () => {
|
|
|
|
it('accepts non-empty string', () => {
|
|
|
|
tray.setTitle('Hello World!')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('accepts empty string', () => {
|
|
|
|
tray.setTitle('')
|
|
|
|
})
|
|
|
|
})
|
2018-08-27 16:58:47 +00:00
|
|
|
})
|