mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
EditSession emits 'title-changed' events when its buffer path changes
This commit is contained in:
committed by
probablycorey
parent
0c24843e52
commit
de8198084c
@@ -16,6 +16,20 @@ describe "EditSession", ->
|
||||
afterEach ->
|
||||
fixturesProject.destroy()
|
||||
|
||||
describe "title", ->
|
||||
it "uses the basename of the buffer's path as its title, or 'untitled' if the path is undefined", ->
|
||||
expect(editSession.getTitle()).toBe 'sample.js'
|
||||
buffer.setPath(undefined)
|
||||
expect(editSession.getTitle()).toBe 'untitled'
|
||||
|
||||
it "emits 'title-changed' events when the underlying buffer path", ->
|
||||
titleChangedHandler = jasmine.createSpy("titleChangedHandler")
|
||||
editSession.on 'title-changed', titleChangedHandler
|
||||
|
||||
buffer.setPath('/foo/bar/baz.txt')
|
||||
buffer.setPath(undefined)
|
||||
expect(titleChangedHandler.callCount).toBe 2
|
||||
|
||||
describe "cursor", ->
|
||||
describe ".getCursor()", ->
|
||||
it "returns the most recently created cursor", ->
|
||||
|
||||
@@ -43,7 +43,9 @@ class EditSession
|
||||
@addCursorAtScreenPosition([0, 0])
|
||||
|
||||
@buffer.retain()
|
||||
@subscribe @buffer, "path-changed", => @trigger "path-changed"
|
||||
@subscribe @buffer, "path-changed", =>
|
||||
@trigger "title-changed"
|
||||
@trigger "path-changed"
|
||||
@subscribe @buffer, "contents-conflicted", => @trigger "contents-conflicted"
|
||||
@subscribe @buffer, "markers-updated", => @mergeCursors()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user