mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Add test coverage for save before close
This commit is contained in:
parent
c6a89a4abe
commit
63b9c8eb4b
@ -5173,12 +5173,16 @@ describe "TextEditor", ->
|
|||||||
expect(editor.getSelectedBufferRange()).toEqual [[13, 0], [14, 2]]
|
expect(editor.getSelectedBufferRange()).toEqual [[13, 0], [14, 2]]
|
||||||
|
|
||||||
describe ".shouldPromptToSave()", ->
|
describe ".shouldPromptToSave()", ->
|
||||||
it "returns false when an edit session's buffer is in use by more than one session", ->
|
it "returns true when buffer changed", ->
|
||||||
jasmine.unspy(editor, 'shouldPromptToSave')
|
jasmine.unspy(editor, 'shouldPromptToSave')
|
||||||
expect(editor.shouldPromptToSave()).toBeFalsy()
|
expect(editor.shouldPromptToSave()).toBeFalsy()
|
||||||
buffer.setText('changed')
|
buffer.setText('changed')
|
||||||
expect(editor.shouldPromptToSave()).toBeTruthy()
|
expect(editor.shouldPromptToSave()).toBeTruthy()
|
||||||
|
|
||||||
|
it "returns false when an edit session's buffer is in use by more than one session", ->
|
||||||
|
jasmine.unspy(editor, 'shouldPromptToSave')
|
||||||
|
buffer.setText('changed')
|
||||||
|
|
||||||
editor2 = null
|
editor2 = null
|
||||||
waitsForPromise ->
|
waitsForPromise ->
|
||||||
atom.workspace.getActivePane().splitRight()
|
atom.workspace.getActivePane().splitRight()
|
||||||
@ -5189,6 +5193,16 @@ describe "TextEditor", ->
|
|||||||
editor2.destroy()
|
editor2.destroy()
|
||||||
expect(editor.shouldPromptToSave()).toBeTruthy()
|
expect(editor.shouldPromptToSave()).toBeTruthy()
|
||||||
|
|
||||||
|
it "returns false when close of a window requested and edit session opened inside project", ->
|
||||||
|
jasmine.unspy(editor, 'shouldPromptToSave')
|
||||||
|
buffer.setText('changed')
|
||||||
|
expect(editor.shouldPromptToSave(windowCloseRequested: true, projectHasPaths: true)).toBeFalsy()
|
||||||
|
|
||||||
|
it "returns true when close of a window requested and edit session opened without project", ->
|
||||||
|
jasmine.unspy(editor, 'shouldPromptToSave')
|
||||||
|
buffer.setText('changed')
|
||||||
|
expect(editor.shouldPromptToSave(windowCloseRequested: true, projectHasPaths: false)).toBeTruthy()
|
||||||
|
|
||||||
describe "when the editor contains surrogate pair characters", ->
|
describe "when the editor contains surrogate pair characters", ->
|
||||||
it "correctly backspaces over them", ->
|
it "correctly backspaces over them", ->
|
||||||
editor.setText('\uD835\uDF97\uD835\uDF97\uD835\uDF97')
|
editor.setText('\uD835\uDF97\uD835\uDF97\uD835\uDF97')
|
||||||
|
Loading…
Reference in New Issue
Block a user