From b5bd7160d2de4cf053de479e2a7619cb8962df99 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 22 May 2013 16:44:09 -0700 Subject: [PATCH] Update window spec --- spec/app/window-spec.coffee | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/spec/app/window-spec.coffee b/spec/app/window-spec.coffee index baf2f68ad..32fd9ab43 100644 --- a/spec/app/window-spec.coffee +++ b/spec/app/window-spec.coffee @@ -124,23 +124,22 @@ describe "Window", -> describe ".unloadEditorWindow()", -> it "saves the serialized state of the window so it can be deserialized after reload", -> + windowState = {} + jasmine.unspy(atom, 'setWindowState') + spyOn(atom, 'setWindowState').andCallFake (key, value) -> windowState[key] = value projectPath = project.getPath() - expect(atom.getWindowState()).toEqual {} # JSON.stringify removes keys with undefined values - rootViewState = JSON.parse(JSON.stringify(rootView.serialize())) - projectState = JSON.parse(JSON.stringify(project.serialize())) - syntaxState = JSON.parse(JSON.stringify(syntax.serialize())) + rootViewState = rootView.serialize() + projectState = project.serialize() + syntaxState = syntax.serialize() window.unloadEditorWindow() - windowState = atom.getWindowState() expect(windowState.rootView).toEqual rootViewState expect(windowState.project).toEqual projectState expect(windowState.syntax).toEqual syntaxState - expect(atom.saveWindowState).toHaveBeenCalled() - it "unsubscribes from all buffers", -> rootView.open('sample.js') buffer = rootView.getActivePaneItem().buffer @@ -151,11 +150,6 @@ describe "Window", -> expect(buffer.subscriptionCount()).toBe 0 - it "only serializes window state the first time it is called", -> - window.unloadEditorWindow() - window.unloadEditorWindow() - expect(atom.saveWindowState.callCount).toBe 1 - describe ".deserialize(state)", -> class Foo @deserialize: ({name}) -> new Foo(name)