Window is only shutdown if a rootView and project exist

Keeping the shutdown state as a local var in window.coffee causes spec failures because window.shutdown can only be called once in the entire spec suite
This commit is contained in:
Corey Johnson & Nathan Sobo
2013-02-20 11:30:39 -08:00
parent b24a13991a
commit 2123fabae6
3 changed files with 16 additions and 13 deletions

View File

@@ -8,7 +8,6 @@ require 'underscore-extensions'
require 'space-pen-extensions'
deserializers = {}
wasShutdown = false
windowAdditions =
rootViewParentSelector: 'body'
@@ -69,8 +68,7 @@ windowAdditions =
$(rootViewParentSelector).append(rootView)
shutdown: ->
return if wasShutdown
wasShutdown = true
return if not project and not rootView
atom.setWindowState('pathToOpen', project.getPath())
atom.setRootViewStateForPath project.getPath(),
project: project.serialize()
@@ -78,6 +76,8 @@ windowAdditions =
rootView.deactivate()
project.destroy()
$(window).off('focus blur before')
window.rootView = null
window.project = null
stylesheetElementForId: (id) ->
$("head style[id='#{id}']")