Clear context menus between specs

This commit is contained in:
Nathan Sobo
2014-09-29 20:25:55 -06:00
parent f082f93ead
commit 915cfe15f5
2 changed files with 14 additions and 11 deletions

View File

@@ -125,6 +125,7 @@ beforeEach ->
afterEach ->
atom.packages.deactivatePackages()
atom.menu.template = []
atom.contextMenu.clear()
atom.workspaceView?.remove?()
atom.workspaceView = null

View File

@@ -20,18 +20,8 @@ SequenceCount = 0
module.exports =
class ContextMenuManager
constructor: ({@resourcePath, @devMode}) ->
@activeElement = null
@itemSets = []
@definitions = {'.overlayer': []} # TODO: Remove once color picker package stops touching private data
@add '.workspace': [{
label: 'Inspect Element'
command: 'application:inspect'
devMode: true
created: (event) ->
{pageX, pageY} = event
@commandOptions = {x: pageX, y: pageY}
}]
@clear()
atom.keymaps.onDidLoadBundledKeymaps => @loadPlatformItems()
@@ -163,6 +153,18 @@ class ContextMenuManager
remote.getCurrentWindow().emit('context-menu', menuTemplate)
return
clear: ->
@activeElement = null
@itemSets = []
@add '.workspace': [{
label: 'Inspect Element'
command: 'application:inspect'
devMode: true
created: (event) ->
{pageX, pageY} = event
@commandOptions = {x: pageX, y: pageY}
}]
class ContextMenuItemSet
constructor: (@selector, @items) ->
@specificity = (SpecificityCache[@selector] ?= specificity(@selector))