mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Event names are present tense, so buffer emits 'path-change'
This commit is contained in:
parent
90242a787f
commit
001d866bec
@ -192,7 +192,7 @@ describe 'Buffer', ->
|
||||
it "saves the contents of the buffer to the path", ->
|
||||
buffer = new Buffer()
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
buffer.on 'path-changed', eventHandler
|
||||
buffer.on 'path-change', eventHandler
|
||||
|
||||
buffer.setText 'Buffer contents!'
|
||||
buffer.saveAs(filePath)
|
||||
@ -405,9 +405,9 @@ describe 'Buffer', ->
|
||||
expect(buffer.positionForCharacterIndex(408)).toEqual [12, 2]
|
||||
|
||||
|
||||
describe "path-changed event", ->
|
||||
it "emits path-changed event when path is changed", ->
|
||||
describe "path-change event", ->
|
||||
it "emits path-change event when path is changed", ->
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
buffer.on 'path-changed', eventHandler
|
||||
buffer.on 'path-change', eventHandler
|
||||
buffer.setPath("moo.text")
|
||||
expect(eventHandler).toHaveBeenCalledWith(buffer)
|
||||
|
@ -21,7 +21,7 @@ describe "Editor", ->
|
||||
describe "construction", ->
|
||||
it "assigns an empty buffer and correctly handles text input (regression coverage)", ->
|
||||
editor = new Editor
|
||||
expect(editor.buffer.path).toBeUndefined()
|
||||
expect(editor.buffer.getPath()).toBeUndefined()
|
||||
expect(editor.lines.find('.line').length).toBe 1
|
||||
editor.insertText('x')
|
||||
expect(editor.lines.find('.line').length).toBe 1
|
||||
@ -1772,7 +1772,7 @@ describe "Editor", ->
|
||||
beforeEach ->
|
||||
tempFilePath = '/tmp/atom-temp.txt'
|
||||
editor.setBuffer new Buffer(tempFilePath)
|
||||
expect(editor.buffer.path).toBe tempFilePath
|
||||
expect(editor.buffer.getPath()).toBe tempFilePath
|
||||
|
||||
afterEach ->
|
||||
expect(fs.remove(tempFilePath))
|
||||
@ -1790,7 +1790,7 @@ describe "Editor", ->
|
||||
selectedFilePath = null
|
||||
beforeEach ->
|
||||
editor.setBuffer new Buffer()
|
||||
expect(editor.buffer.path).toBeUndefined()
|
||||
expect(editor.buffer.getPath()).toBeUndefined()
|
||||
editor.buffer.setText 'Save me to a new path'
|
||||
spyOn($native, 'saveDialog').andCallFake -> selectedFilePath
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Buffer
|
||||
setPath: (path) ->
|
||||
@url = path # we want this to be path on master, but let's not break it on a branch
|
||||
@path = path
|
||||
@trigger "path-changed", this
|
||||
@trigger "path-change", this
|
||||
|
||||
getText: ->
|
||||
@lines.join('\n')
|
||||
|
Loading…
Reference in New Issue
Block a user