From 50ade54c3cf35827b59411f0eaa826ca4efae673 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sun, 21 Jul 2013 16:55:44 -0600 Subject: [PATCH] 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. --- spec/app/pane-spec.coffee | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/spec/app/pane-spec.coffee b/spec/app/pane-spec.coffee index 9a0305baa..cdf775a1b 100644 --- a/spec/app/pane-spec.coffee +++ b/spec/app/pane-spec.coffee @@ -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)')