mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Update window spec
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user