Also serialize project in pane specs that remove the pane from the DOM

The project contains the only reference to the buffer that belongs to
the edit session in the serialized pane. If we tear down the pane then
the edit session is destroyed and the buffer is removed. So we have to
serialize and restore the project to its previous state once we finish
tearing down the view.
This commit is contained in:
Nathan Sobo
2013-07-21 16:55:44 -06:00
parent d43f459ad1
commit 50ade54c3c

View File

@@ -728,17 +728,21 @@ describe "Pane", ->
expect(newPane.items.length).toBe pane.items.length - 1
it "focuses the pane after attach only if had focus when serialized", ->
container.attachToDom()
reloadContainer = ->
projectState = project.serialize()
containerState = container.serialize()
container.remove()
project.destroy()
window.project = deserialize(projectState)
container = deserialize(containerState)
pane = container.getRoot()
container.attachToDom()
container.attachToDom()
pane.focus()
state = pane.serialize()
pane.remove()
newPane = deserialize(state)
container.setRoot(newPane)
expect(newPane).toMatchSelector(':has(:focus)')
reloadContainer()
expect(pane).toMatchSelector(':has(:focus)')
$(document.activeElement).blur()
state = newPane.serialize()
newPane.remove()
newerPane = deserialize(state)
expect(newerPane).not.toMatchSelector(':has(:focus)')
reloadContainer()
expect(pane).not.toMatchSelector(':has(:focus)')