diff --git a/spec/context-menu-manager-spec.coffee b/spec/context-menu-manager-spec.coffee index 9c3c02175..821cb115d 100644 --- a/spec/context-menu-manager-spec.coffee +++ b/spec/context-menu-manager-spec.coffee @@ -82,13 +82,15 @@ describe "ContextMenuManager", -> disposable1.dispose() expect(contextMenu.templateForElement(grandchild)).toEqual [{label: 'A', command: 'd'}] - it "allows multiple separators", -> + it "allows multiple separators, but not adjacent to each other", -> contextMenu.add '.grandchild': [ {label: 'A', command: 'a'}, {type: 'separator'}, + {type: 'separator'}, {label: 'B', command: 'b'}, {type: 'separator'}, + {type: 'separator'}, {label: 'C', command: 'c'} ] diff --git a/src/menu-helpers.coffee b/src/menu-helpers.coffee index a8fd26a50..f360e7e9a 100644 --- a/src/menu-helpers.coffee +++ b/src/menu-helpers.coffee @@ -13,7 +13,7 @@ merge = (menu, item, itemSpecificity=Infinity) -> else if itemSpecificity unless itemSpecificity < ItemSpecificities.get(matchingItem) menu[matchingItemIndex] = item - else + else unless item.type is 'separator' and _.last(menu)?.type is 'separator' menu.push(item) unmerge = (menu, item) ->