From 3c6a7c332a38b7cc81430f7daf24047c2d554a62 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 26 Sep 2017 20:05:51 -0400 Subject: [PATCH] add unit test for getMenuItemById --- spec/api-menu-spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/api-menu-spec.js b/spec/api-menu-spec.js index 9b1f3de36906..4389f9d50db7 100644 --- a/spec/api-menu-spec.js +++ b/spec/api-menu-spec.js @@ -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 () { it('should store item in @items by its index', function () { var menu = Menu.buildFromTemplate([