Add 'editor:active-edit-session-changed' events to Editor

This commit is contained in:
Nathan Sobo
2012-11-20 15:23:30 -07:00
parent 2d8ffef96b
commit 056c6c5af2
2 changed files with 14 additions and 0 deletions

View File

@@ -277,6 +277,19 @@ describe "Editor", ->
runs ->
expect(atom.confirm).toHaveBeenCalled()
it "emits an editor:active-edit-session-changed event with the edit session and its index", ->
activeEditSessionChangeHandler = jasmine.createSpy('activeEditSessionChangeHandler')
editor.on 'editor:active-edit-session-changed', activeEditSessionChangeHandler
editor.setActiveEditSessionIndex(2)
expect(activeEditSessionChangeHandler).toHaveBeenCalled()
expect(activeEditSessionChangeHandler.argsForCall[0][1]).toBe 2
activeEditSessionChangeHandler.reset()
editor.setActiveEditSessionIndex(0)
expect(activeEditSessionChangeHandler.argsForCall[0][1]).toBe 0
activeEditSessionChangeHandler.reset()
describe ".loadNextEditSession()", ->
it "loads the next editor state and wraps to beginning when end is reached", ->
expect(editor.activeEditSession).toBe session2

View File

@@ -430,6 +430,7 @@ class Editor extends View
@trigger 'editor-path-change'
@trigger 'editor-path-change'
@trigger 'editor:active-edit-session-changed', index
@resetDisplay()
if @attached and @activeEditSession.buffer.isInConflict()