mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
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:
committed by
probablycorey
parent
59a06acc0b
commit
3f9ee08e76
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user