Move specs for Workspace::reopenItemSync to model layer

This commit is contained in:
Nathan Sobo
2014-01-21 14:20:48 -07:00
parent 3fad9c616f
commit 71c65e65eb
2 changed files with 33 additions and 33 deletions

View File

@@ -146,3 +146,36 @@ describe "Workspace", ->
expect(workspace.paneContainer.root.children).toEqual [pane1, pane2]
expect(pane2.items).toEqual [editor1]
expect(pane1.items).toEqual []
describe "::reopenItemSync()", ->
it "opens the uri associated with the last closed pane that isn't currently open", ->
pane = workspace.activePane
workspace.openSync('a')
workspace.openSync('b')
workspace.openSync('file1')
workspace.openSync()
# does not reopen items with no uri
expect(workspace.activePaneItem.getUri()).toBeUndefined()
pane.destroyActiveItem()
workspace.reopenItemSync()
expect(workspace.activePaneItem.getUri()).not.toBeUndefined()
# destroy all items
expect(workspace.activePaneItem.getUri()).toBe 'file1'
pane.destroyActiveItem()
expect(workspace.activePaneItem.getUri()).toBe 'b'
pane.destroyActiveItem()
expect(workspace.activePaneItem.getUri()).toBe 'a'
pane.destroyActiveItem()
# reopens items with uris
expect(workspace.activePaneItem).toBeUndefined()
workspace.reopenItemSync()
expect(workspace.activePaneItem.getUri()).toBe 'a'
# does not reopen items that are already open
workspace.openSync('b')
expect(workspace.activePaneItem.getUri()).toBe 'b'
workspace.reopenItemSync()
expect(workspace.activePaneItem.getUri()).toBe 'file1'

View File

@@ -251,39 +251,6 @@ describe "WorkspaceView", ->
atom.workspaceView.getActiveView().splitRight()
expect(count).toBe 2
describe ".reopenItemSync()", ->
it "opens the uri associated with the last closed pane that isn't currently open", ->
workspace = atom.workspaceView
pane = workspace.getActivePane()
workspace.openSync('b')
workspace.openSync('file1')
workspace.openSync()
# does not reopen items with no uri
expect(workspace.getActivePaneItem().getUri()).toBeUndefined()
pane.destroyActiveItem()
workspace.reopenItemSync()
expect(workspace.getActivePaneItem().getUri()).not.toBeUndefined()
# destroy all items
expect(workspace.getActivePaneItem().getUri()).toBe 'file1'
pane.destroyActiveItem()
expect(workspace.getActivePaneItem().getUri()).toBe 'b'
pane.destroyActiveItem()
expect(workspace.getActivePaneItem().getUri()).toBe 'a'
pane.destroyActiveItem()
# reopens items with uris
expect(workspace.getActivePaneItem()).toBeUndefined()
workspace.reopenItemSync()
expect(workspace.getActivePaneItem().getUri()).toBe 'a'
# does not reopen items that are already open
workspace.openSync('b')
expect(workspace.getActivePaneItem().getUri()).toBe 'b'
workspace.reopenItemSync()
expect(workspace.getActivePaneItem().getUri()).toBe 'file1'
describe "core:close", ->
it "closes the active pane item until all that remains is a single empty pane", ->
atom.config.set('core.destroyEmptyPanes', true)