Move eachBuffer spec to project-spec

This commit is contained in:
Kevin Sawicki 2013-11-26 14:24:48 -08:00
parent 4c336ed0ee
commit 3cfe50585a
2 changed files with 29 additions and 29 deletions

View File

@ -545,3 +545,32 @@ describe "Project", ->
resultForA = _.find results, ({filePath}) -> path.basename(filePath) == 'a'
expect(resultForA.matches).toHaveLength 1
expect(resultForA.matches[0].matchText).toBe 'Elephant'
describe ".eachBuffer(callback)", ->
beforeEach ->
atom.project.bufferForPathSync('a')
it "invokes the callback for existing buffer", ->
count = 0
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.project.eachBuffer(callback)
expect(count).toBe 1
expect(callbackBuffer).toBe atom.project.getBuffers()[0]
it "invokes the callback for new buffers", ->
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.project.eachBuffer(callback)
count = 0
callbackBuffer = null
atom.project.bufferForPathSync(require.resolve('./fixtures/sample.txt'))
expect(count).toBe 1
expect(callbackBuffer).toBe atom.project.getBuffers()[1]

View File

@ -526,32 +526,3 @@ describe "WorkspaceView", ->
subscription.off()
atom.workspaceView.getActiveView().splitRight()
expect(count).toBe 2
describe ".eachBuffer(callback)", ->
beforeEach ->
atom.workspaceView.attachToDom()
it "invokes the callback for existing buffer", ->
count = 0
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.workspaceView.eachBuffer(callback)
expect(count).toBe 1
expect(callbackBuffer).toBe atom.workspaceView.getActiveView().getBuffer()
it "invokes the callback for new buffer", ->
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.workspaceView.eachBuffer(callback)
count = 0
callbackBuffer = null
atom.workspaceView.openSync(require.resolve('./fixtures/sample.txt'))
expect(count).toBe 1
expect(callbackBuffer).toBe atom.workspaceView.getActiveView().getBuffer()