     expect(autocomplete.list.prop('scrollWidth')).toBe autocomplete.list.width()
 
   it "includes completions for the scope's completion preferences", ->
+    cssEditorView = null
+
     waitsForPromise ->
       atom.packages.activatePackage('language-css')
 
+    waitsForPromise ->
+      atom.workspace.open('css.css').then (editor) ->
+        cssEditorView = new EditorView({editor})
+
     runs ->
-      cssEditorView = new EditorView(editor: atom.project.openSync('css.css'))
       cssEditor = cssEditorView.editor
       autocomplete = new AutocompleteView(cssEditorView)
 

      describe "when `autocomplete.includeCompletionsFromAllBuffers` is true", ->
        it "shows words from all open buffers", ->
          atom.config.set('autocomplete.includeCompletionsFromAllBuffers', true)
          atom.project.openSync('sample.txt')
          editor.getBuffer().insert([10,0] ,"extra:SO:extra")
          editor.setCursorBufferPosition([10,8])
          autocomplete.attach()

          expect(autocomplete.list.find('li').length).toBe 2
          expect(autocomplete.list.find('li:eq(0)')).toHaveText('Some')
          expect(autocomplete.list.find('li:eq(1)')).toHaveText('sort')

      describe 'where many cursors are defined', ->
        it 'autocompletes word when there is only a prefix', ->


  beforeEach ->
    atom.workspaceView = new WorkspaceView

    waitsForPromise ->
      atom.workspace.open('sample.js').then (editor) ->
        editorView = new EditorView({editor})

    runs ->
      {editor} = editorView
      autocomplete = new AutocompleteView(editorView)
      miniEditor = autocomplete.filterEditorView

  describe 'autocomplete:toggle event', ->
    it "shows autocomplete view and focuses its mini-editor", ->
