diff --git a/spec/context-menu-manager-spec.coffee b/spec/context-menu-manager-spec.coffee index 42c833bda..80fcd3db9 100644 --- a/spec/context-menu-manager-spec.coffee +++ b/spec/context-menu-manager-spec.coffee @@ -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', diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 51a13ca2d..f22ee92ea 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -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})