Don't close edit session when its buffer is modified

This commit is contained in:
Corey Johnson 2012-06-11 17:35:21 -07:00
parent 9339791260
commit 0fec1fc5ba
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -784,6 +784,7 @@ class Editor extends View
close: ->
return if @mini
return if @buffer.isModified()
@removeActiveEditSession()
unsubscribeFromBuffer: ->