mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
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:
@@ -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)')
|
||||
|
||||
Reference in New Issue
Block a user