electron/spec/api-tray-spec.js

48 lines
949 B
JavaScript
Raw Normal View History

2018-09-13 16:10:51 +00:00
const { remote } = require('electron')
const { Menu, Tray, nativeImage } = remote
describe('tray module', () => {
let tray
beforeEach(() => {
tray = new Tray(nativeImage.createEmpty())
})
afterEach(() => {
tray.destroy()
tray = null
})
describe('tray.setContextMenu', () => {
it('accepts menu instance', () => {
tray.setContextMenu(new Menu())
})
it('accepts null', () => {
tray.setContextMenu(null)
})
})
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('')
})
})
})