         expect(selectedItem).toHaveClass('search-result')
         expect(selectedItem[0]).toBe resultsView.find('.path:eq(0) .search-result:first')[0]
 
+      describe "when nothing is selected", ->
+        it "doesnt error when the user arrows down", ->
+          resultsView.find('.selected').removeClass('selected')
+          expect(resultsView.find('.selected')).not.toExist()
+          resultsView.trigger 'core:move-down'
+          expect(resultsView.find('.selected')).toExist()
+
+        it "doesnt error when the user arrows up", ->
+          resultsView.find('.selected').removeClass('selected')
+          expect(resultsView.find('.selected')).not.toExist()
+          resultsView.trigger 'core:move-up'
+          expect(resultsView.find('.selected')).toExist()
+
+      describe "when there are collapsed results", ->
+        it "moves to the correct next result when a path is selected", ->
+          resultsView.find('.selected').removeClass('selected')
+          resultsView.find('.path:eq(0) .search-result:last').addClass('selected')
+          resultsView.find('.path:eq(1)').view().expand(false)
+
+          resultsView.trigger 'core:move-down'
+
+          selectedItem = resultsView.find('.selected')
+          expect(selectedItem).toHaveClass('path')
+          expect(selectedItem[0]).toBe resultsView.find('.path:eq(1)')[0]
+
+        it "moves to the correct previous result when a path is selected", ->
+          resultsView.find('.selected').removeClass('selected')
+          resultsView.find('.path:eq(1) .search-result:first').addClass('selected')
+          resultsView.find('.path:eq(0)').view().expand(false)
+
+          resultsView.trigger 'core:move-up'
+
+          selectedItem = resultsView.find('.selected')
+          expect(selectedItem).toHaveClass('path')
+          expect(selectedItem[0]).toBe resultsView.find('.path:eq(0)')[0]
 
   describe "when the results view is empty", ->
     it "ignores core:confirm events", ->

        expect(resultsView.find("li").length).toBe resultsView.getPathCount() + resultsView.getMatchCount()

  describe "arrowing through the list", ->
    describe "when nothing is selected", ->
      beforeEach ->
        projectFindView.findEditor.setText('items')
        projectFindView.trigger 'core:confirm'

      it "doesnt error when the user arrows down", ->
        waitsForPromise ->
          searchPromise

        runs ->
          resultsView = getResultsView()
          resultsView.find('.selected').removeClass('selected')
          expect(resultsView.find('.selected')).not.toExist()
          resultsView.trigger 'core:move-down'
          expect(resultsView.find('.selected')).toExist()

      it "doesnt error when the user arrows up", ->
        waitsForPromise ->
          searchPromise

        runs ->
          resultsView = getResultsView()
          resultsView.find('.selected').removeClass('selected')
          expect(resultsView.find('.selected')).not.toExist()
          resultsView.trigger 'core:move-up'
          expect(resultsView.find('.selected')).toExist()

    it "arrows through the list without selecting paths", ->
      openHandler = null

      waitsForPromise ->

        activePane = atom.workspaceView.getActivePaneView()
        expect(atom.workspace.getActivePaneItem().getPath()).toContain('sample.')

    it "arrows through the entire list without selecting paths and overshooting the boundaries", ->
      waitsForPromise ->
        atom.workspace.open('sample.js')

