diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index d5a10b728..fc0fcdee0 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1675,6 +1675,7 @@ describe "Editor", -> expect(editor.buffer).toBe buffer it "calls remove on the editor if there is one edit session and mini is false", -> + originalBuffer = editor.buffer expect(editor.mini).toBeFalsy() expect(editor.editSessions.length).toBe 1 spyOn(editor, 'remove') @@ -1686,3 +1687,11 @@ describe "Editor", -> spyOn(editor, 'remove') editor.trigger 'close' expect(editor.remove).not.toHaveBeenCalled() + + describe "when buffer is modified", -> + it "triggers alert and does not close session", -> + originalBuffer = editor.buffer + editor.insertText("I AM CHANGED!") + editor.trigger "close" + expect(editor.buffer).toBe originalBuffer + diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 0bd70f441..dfb50f4c0 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -784,6 +784,7 @@ class Editor extends View close: -> return if @mini + return if @buffer.isModified() @removeActiveEditSession() unsubscribeFromBuffer: ->