Add initial global shortcut spec
This commit is contained in:
parent
39e1541a7e
commit
a6353eb98f
1 changed files with 24 additions and 0 deletions
24
spec/api-global-shortcut-spec.js
Normal file
24
spec/api-global-shortcut-spec.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const {globalShortcut} = require('electron').remote
|
||||
const assert = require('assert')
|
||||
|
||||
describe('globalShortcut module', () => {
|
||||
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)
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue