Update window spec

This commit is contained in:
probablycorey
2013-05-22 16:44:09 -07:00
parent ce4cb0db80
commit b5bd7160d2

View File

@@ -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)