diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index ef747e6e2..04e6c9b57 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -139,7 +139,6 @@ describe "Editor", -> expect(editor.verticalScrollbar.prop('scrollHeight')).toBe previousScrollHeight expect(editor.scrollTop()).toBe previousScrollTop expect(editor.scrollView.scrollLeft()).toBe previousScrollLeft - console.log editor.getCursorView().css('left') expect(editor.getCursorView().position()).toEqual { top: 3 * editor.lineHeight, left: 5 * editor.charWidth } editor.insertText("goodbye") expect(editor.lineElementForScreenRow(3).text()).toMatch /^ vgoodbyear/ @@ -162,54 +161,6 @@ describe "Editor", -> runs -> expect(atom.confirm).toHaveBeenCalled() - describe ".save()", -> - describe "when the current buffer has a path", -> - tempFilePath = null - - beforeEach -> - project.setPath('/tmp') - tempFilePath = '/tmp/atom-temp.txt' - fs.write(tempFilePath, "") - editor.edit(project.buildEditSession(tempFilePath)) - - afterEach -> - expect(fs.remove(tempFilePath)) - - it "saves the current buffer to disk", -> - editor.getBuffer().setText 'Edited!' - expect(fs.read(tempFilePath)).not.toBe "Edited!" - - editor.save() - - expect(fs.exists(tempFilePath)).toBeTruthy() - expect(fs.read(tempFilePath)).toBe 'Edited!' - - describe "when the current buffer has no path", -> - selectedFilePath = null - beforeEach -> - editor.edit(project.buildEditSession()) - editor.getBuffer().setText 'Save me to a new path' - spyOn(atom, 'showSaveDialog').andCallFake (callback) -> callback(selectedFilePath) - - it "presents a 'save as' dialog", -> - editor.save() - expect(atom.showSaveDialog).toHaveBeenCalled() - - describe "when a path is chosen", -> - it "saves the buffer to the chosen path", -> - selectedFilePath = '/tmp/temp.txt' - - editor.save() - - expect(fs.exists(selectedFilePath)).toBeTruthy() - expect(fs.read(selectedFilePath)).toBe 'Save me to a new path' - - describe "when dialog is cancelled", -> - it "does not save the buffer", -> - selectedFilePath = null - editor.save() - expect(fs.exists(selectedFilePath)).toBeFalsy() - describe ".scrollTop(n)", -> beforeEach -> editor.attachToDom(heightInLines: 5) @@ -2025,7 +1976,7 @@ describe "Editor", -> it "restores the contents of the editor to the HEAD revision", -> editor.setText('') - editor.save() + editor.getBuffer().save() fileChangeHandler = jasmine.createSpy('fileChange') editor.getBuffer().file.on 'contents-changed', fileChangeHandler diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 0f900eb47..a87790158 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -348,7 +348,7 @@ class Editor extends View @hiddenInput.on 'focusout', => @isFocused = false - @autosave() if config.get "editor.autosave" +# @autosave() if config.get "editor.autosave" @removeClass 'is-focused' @underlayer.on 'click', (e) => @@ -456,7 +456,7 @@ class Editor extends View return if editSession is @activeEditSession if @activeEditSession - @autosave() if config.get "editor.autosave" +# @autosave() if config.get "editor.autosave" @saveScrollPositionForActiveEditSession() @activeEditSession.off(".editor") @@ -609,8 +609,8 @@ class Editor extends View @removeClass 'soft-wrap' $(window).off 'resize', @_setSoftWrapColumn - autosave: -> - @save() if @getPath()? +# autosave: -> +# @save() if @getPath()? setFontSize: (fontSize) -> headTag = $("head") diff --git a/src/packages/status-bar/spec/status-bar-spec.coffee b/src/packages/status-bar/spec/status-bar-spec.coffee index 8f22d6d31..f7a88cf4d 100644 --- a/src/packages/status-bar/spec/status-bar-spec.coffee +++ b/src/packages/status-bar/spec/status-bar-spec.coffee @@ -63,7 +63,7 @@ describe "StatusBar", -> editor.insertText("\n") advanceClock(buffer.stoppedChangingDelay) expect(statusBar.bufferModified.text()).toBe '*' - editor.save() + editor.getBuffer().save() expect(statusBar.bufferModified.text()).toBe '' it "disables the buffer modified indicator if the content matches again", -> diff --git a/src/packages/strip-trailing-whitespace/spec/strip-trailing-whitespace-spec.coffee b/src/packages/strip-trailing-whitespace/spec/strip-trailing-whitespace-spec.coffee index e1fc838de..17277b059 100644 --- a/src/packages/strip-trailing-whitespace/spec/strip-trailing-whitespace-spec.coffee +++ b/src/packages/strip-trailing-whitespace/spec/strip-trailing-whitespace-spec.coffee @@ -23,7 +23,7 @@ describe "StripTrailingWhitespace", -> # works for buffers that are already open when extension is initialized editor.insertText("foo \nbar\t \n\nbaz") - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "foo\nbar\n\nbaz" # works for buffers that are opened after extension is initialized @@ -47,25 +47,25 @@ describe "StripTrailingWhitespace", -> it "adds a trailing newline when there is no trailing newline", -> editor.insertText "foo" - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "foo\n" it "removes extra trailing newlines and only keeps one", -> editor.insertText "foo\n\n\n\n" - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "foo\n" it "leaves a buffer with a single trailing newline untouched", -> editor.insertText "foo\nbar\n" - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "foo\nbar\n" it "leaves an empty buffer untouched", -> editor.insertText "" - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "" it "leaves a buffer that is a single newline untouched", -> editor.insertText "\n" - editor.save() + editor.getBuffer().save() expect(editor.getText()).toBe "\n"