mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Listen for file events before acting on the file.
This commit is contained in:
parent
df3c00ac9c
commit
211d18bf99
@ -155,9 +155,11 @@ describe 'Buffer', ->
|
||||
expect(bufferToDelete.getPath()).toBe path
|
||||
expect(bufferToDelete.isModified()).toBeFalsy()
|
||||
|
||||
removeHandler = jasmine.createSpy('removeHandler')
|
||||
bufferToDelete.file.on 'removed', removeHandler
|
||||
fs.remove(path)
|
||||
waitsFor "file to be removed", (done) ->
|
||||
bufferToDelete.file.one 'removed', done
|
||||
waitsFor "file to be removed", ->
|
||||
removeHandler.callCount > 0
|
||||
|
||||
afterEach ->
|
||||
bufferToDelete.destroy()
|
||||
@ -173,8 +175,10 @@ describe 'Buffer', ->
|
||||
|
||||
fs.write(path, 'moo')
|
||||
|
||||
waitsFor 'change event', (done) ->
|
||||
bufferToDelete.one 'changed', done
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
bufferToDelete.on 'changed', changeHandler
|
||||
waitsFor 'change event', ->
|
||||
changeHandler.callCount > 0
|
||||
|
||||
describe ".isModified()", ->
|
||||
it "returns true when user changes buffer", ->
|
||||
@ -980,9 +984,11 @@ describe 'Buffer', ->
|
||||
expect(bufferToDelete.isModified()).toBeFalsy()
|
||||
expect(contentsModifiedHandler).not.toHaveBeenCalled()
|
||||
|
||||
removeHandler = jasmine.createSpy('removeHandler')
|
||||
bufferToDelete.file.on 'removed', removeHandler
|
||||
fs.remove(path)
|
||||
waitsFor "file to be removed", (done) ->
|
||||
bufferToDelete.file.one 'removed', done
|
||||
waitsFor "file to be removed", ->
|
||||
removeHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
expect(contentsModifiedHandler).toHaveBeenCalledWith(differsFromDisk:true)
|
||||
|
Loading…
Reference in New Issue
Block a user