diff --git a/spec/pane-spec.coffee b/spec/pane-spec.coffee index f5b5b5e90..10a405f94 100644 --- a/spec/pane-spec.coffee +++ b/spec/pane-spec.coffee @@ -173,6 +173,27 @@ describe "Pane", -> pane.saveActiveItem() expect(atom.showSaveDialogSync).not.toHaveBeenCalled() + describe "::saveActiveItemAs()", -> + [pane, activeItemUri] = [] + + beforeEach -> + pane = new Pane(items: [new Item("A")]) + spyOn(atom, 'showSaveDialogSync').andReturn('/selected/path') + pane.activeItem.getUri = -> "test" + + describe "when the current item has a saveAs method", -> + it "opens the save dialog and calls saveAs on the item with the selected path", -> + pane.activeItem.saveAs = jasmine.createSpy("saveAs") + pane.saveActiveItemAs() + expect(atom.showSaveDialogSync).toHaveBeenCalledWith(activeItemUri) + expect(pane.activeItem.saveAs).toHaveBeenCalledWith('/selected/path') + + describe "when the current item does not have a saveAs method", -> + it "does nothing", -> + expect(pane.activeItem.saveAs).toBeUndefined() + pane.saveActiveItemAs() + expect(atom.showSaveDialogSync).not.toHaveBeenCalled() + describe "::moveItem(item, index)", -> it "moves the item to the given index and emits an 'item-moved' event with the item and its new index", -> pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C"), new Item("D")]) diff --git a/spec/pane-view-spec.coffee b/spec/pane-view-spec.coffee index 8564a7579..4eb10af31 100644 --- a/spec/pane-view-spec.coffee +++ b/spec/pane-view-spec.coffee @@ -138,26 +138,6 @@ describe "PaneView", -> paneModel2.activateItemAtIndex(1) expect(view1.data('preservative')).toBe 1234 - describe "::saveActiveItemAs()", -> - beforeEach -> - spyOn(atom, 'showSaveDialogSync').andReturn('/selected/path') - - 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(editor2, 'saveAs') - pane.activateItem(editor2) - - pane.saveActiveItemAs() - - expect(atom.showSaveDialogSync).toHaveBeenCalledWith(path.dirname(editor2.getPath())) - expect(editor2.saveAs).toHaveBeenCalledWith('/selected/path') - - describe "when the current item does not have a saveAs method", -> - it "does nothing", -> - expect(pane.activeItem.saveAs).toBeUndefined() - pane.saveActiveItemAs() - expect(atom.showSaveDialogSync).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