minor changes

This commit is contained in:
Erik Håkansson 2014-05-17 12:40:43 +02:00
parent 5ca6d01911
commit 6295c2ddc4
2 changed files with 12 additions and 1 deletions

View File

@ -17,6 +17,17 @@ describe "ContextMenuManager", ->
expect(contextMenu.definitions['.selector'][0].label).toEqual 'label'
expect(contextMenu.definitions['.selector'][0].command).toEqual 'command'
it "loads submenus", ->
contextMenu.add 'file-path',
'.selector':
'parent': [
'child-1': 'child-1:trigger'
'child-2': 'child-1:trigger'
]
'parent-2': 'parent-2:trigger'
describe 'dev mode', ->
it 'loads', ->
contextMenu.add 'file-path',

View File

@ -34,7 +34,7 @@ class ContextMenuManager
add: (name, object, {devMode}={}) ->
for selector, items of object
for label, commandOrSubmenu of items
if (typeof commandOrSubmenu == 'object')
if typeof commandOrSubmenu is 'object'
@addBySelector(selector, commandOrSubmenu, {devMode})
else
@addBySelector(selector, {label, commandOrSubmenu}, {devMode})