       spyOn(SymbolsView.prototype, "moveToPosition").andCallThrough()
       atom.workspaceView.getActiveView().trigger 'symbols-view:go-to-declaration'
 
+      waitsForPromise ->
+        activationPromise
+
       waitsFor ->
         SymbolsView.prototype.moveToPosition.callCount == 1
 

      editor.setCursorBufferPosition([8,14])
      atom.workspaceView.getActiveView().trigger 'symbols-view:go-to-declaration'

      symbolsView = atom.workspaceView.find('.symbols-view').view()
      expect(symbolsView.list.children('li').length).toBe 2
      expect(symbolsView).toBeVisible()
      spyOn(SymbolsView.prototype, "moveToPosition").andCallThrough()
      symbolsView.confirmed(symbolsView.array[0])

      waitsFor ->
        SymbolsView.prototype.moveToPosition.callCount == 1

TagGenerator = require '../lib/tag-generator'

describe "SymbolsView", ->
  [symbolsView, setArraySpy, setErrorSpy, activationPromise] = []

  beforeEach ->
    atom.workspaceView = new WorkspaceView
    activationPromise = atom.packages.activatePackage("symbols-view")

    atom.workspaceView.attachToDom()
    setArraySpy = spyOn(SymbolsView.prototype, 'setArray').andCallThrough()
