Handle save-as on pane. Replace 'editor:save-as' w/ 'core:save-as'

Pane will only show the saveAs dialog if the item has a `saveAs` method.
This commit is contained in:
Nathan Sobo
2013-02-28 18:00:04 -07:00
committed by probablycorey
parent 59a06acc0b
commit 3f9ee08e76
5 changed files with 33 additions and 10 deletions

View File

@@ -306,6 +306,27 @@ describe "Pane", ->
pane.trigger 'core:save'
expect(atom.showSaveDialog).not.toHaveBeenCalled()
describe "core:save-as", ->
beforeEach ->
spyOn(atom, 'showSaveDialog')
describe "when the current item has a saveAs method", ->
it "opens the save dialog and calls saveAs on the item with the selected path", ->
spyOn(editSession2, 'saveAs')
pane.showItem(editSession2)
pane.trigger 'core:save-as'
expect(atom.showSaveDialog).toHaveBeenCalled()
atom.showSaveDialog.argsForCall[0][0]('/selected/path')
expect(editSession2.saveAs).toHaveBeenCalledWith('/selected/path')
describe "when the current item does not have a saveAs method", ->
it "does nothing", ->
expect(pane.activeItem.saveAs).toBeUndefined()
pane.trigger 'core:save-as'
expect(atom.showSaveDialog).not.toHaveBeenCalled()
describe "pane:show-next-item and pane:show-previous-item", ->
it "advances forward/backward through the pane's items, looping around at either end", ->
expect(pane.activeItem).toBe view1