2017-10-27 01:41:06 +00:00
|
|
|
const {globalShortcut} = require('electron').remote
|
2016-08-09 22:10:51 +00:00
|
|
|
|
2017-10-27 01:41:06 +00:00
|
|
|
const assert = require('assert')
|
|
|
|
const isCI = require('electron').remote.getGlobal('isCi')
|
2016-08-10 15:51:29 +00:00
|
|
|
|
2017-10-27 01:41:06 +00:00
|
|
|
describe.only('globalShortcut module', () => {
|
2017-10-27 00:49:21 +00:00
|
|
|
if (isCI && process.platform === 'win32') return
|
2016-08-10 15:51:29 +00:00
|
|
|
|
2016-08-09 22:10:51 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
globalShortcut.unregisterAll()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can register and unregister accelerators', () => {
|
|
|
|
const accelerator = 'CommandOrControl+A+B+C'
|
|
|
|
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), false)
|
|
|
|
globalShortcut.register(accelerator, () => {})
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), true)
|
|
|
|
globalShortcut.unregister(accelerator)
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), false)
|
|
|
|
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), false)
|
|
|
|
globalShortcut.register(accelerator, () => {})
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), true)
|
|
|
|
globalShortcut.unregisterAll()
|
|
|
|
assert.equal(globalShortcut.isRegistered(accelerator), false)
|
|
|
|
})
|
|
|
|
})
|