add unit test for getMenuItemById

This commit is contained in:
Shelley Vohr 2017-09-26 20:05:51 -04:00
parent f49f7d65a5
commit 3c6a7c332a
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -195,6 +195,29 @@ describe('menu module', function () {
}) })
}) })
describe('Menu.getMenuItemById', function () {
it('should return the item with the given id', function () {
var menu = Menu.buildFromTemplate([
{
label: 'View',
submenu: [
{
label: 'Enter Fullscreen',
accelerator: 'Control+Command+F',
id: 'fullScreen'
},
{
label: 'Exit Fullscreen',
accelerator: 'Control+Command+F'
}
]
}
])
const fsc = menu.getMenuItemById('fullScreen')
assert.equal(menu.items[0].submenu.items[0], fsc)
})
})
describe('Menu.insert', function () { describe('Menu.insert', function () {
it('should store item in @items by its index', function () { it('should store item in @items by its index', function () {
var menu = Menu.buildFromTemplate([ var menu = Menu.buildFromTemplate([