api-tray-spec.js 945 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const {remote} = require('electron')
  2. const {Menu, Tray, nativeImage} = remote
  3. describe('tray module', () => {
  4. let tray
  5. beforeEach(() => {
  6. tray = new Tray(nativeImage.createEmpty())
  7. })
  8. afterEach(() => {
  9. tray.destroy()
  10. tray = null
  11. })
  12. describe('tray.setContextMenu', () => {
  13. it('accepts menu instance', () => {
  14. tray.setContextMenu(new Menu())
  15. })
  16. it('accepts null', () => {
  17. tray.setContextMenu(null)
  18. })
  19. })
  20. describe('tray.setImage', () => {
  21. it('accepts empty image', () => {
  22. tray.setImage(nativeImage.createEmpty())
  23. })
  24. })
  25. describe('tray.setPressedImage', () => {
  26. it('accepts empty image', () => {
  27. tray.setPressedImage(nativeImage.createEmpty())
  28. })
  29. })
  30. describe('tray.setTitle', () => {
  31. it('accepts non-empty string', () => {
  32. tray.setTitle('Hello World!')
  33. })
  34. it('accepts empty string', () => {
  35. tray.setTitle('')
  36. })
  37. })
  38. })