mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Don't close edit session when its buffer is modified
This commit is contained in:
parent
9339791260
commit
0fec1fc5ba
@ -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
|
||||
|
||||
|
@ -784,6 +784,7 @@ class Editor extends View
|
||||
|
||||
close: ->
|
||||
return if @mini
|
||||
return if @buffer.isModified()
|
||||
@removeActiveEditSession()
|
||||
|
||||
unsubscribeFromBuffer: ->
|
||||
|
Loading…
Reference in New Issue
Block a user