               """
 
       it "move to next/previous", ->
+        jasmine.useRealClock()
+
+        setActiveTextEditorWithWaits(editor)
+
+        r1 = [[0, 0], [0, 3]] # `line` range of "line 1"
+        r2 = [[1, 2], [1, 6]] # `line` range of "  line 2"
+        r3 = [[2, 0], [2, 3]] # `line` range of "line 3"
+        r4 = [[3, 2], [3, 6]] # `line` range of "  line 4"
+
         setCursor = (point) -> runs -> editor.setCursorBufferPosition(point)
-
-        jasmine.useRealClock()
-
-        setActiveTextEditorWithWaits(editor)
-
-        r1 = new Range([0, 0], [0, 3])
-        r2 = new Range([1, 2], [1, 6])
-        r3 = new Range([2, 0], [2, 3])
-        r4 = new Range([3, 2], [3, 6])
-
-        setCursor(r1.start); nextItem(); runs -> ensureEditor editor, cursor: [1, 2]
-        setCursor(r1.end); nextItem(); runs -> ensureEditor editor, cursor: [1, 2]
-        setCursor(r1.start); previousItem(); runs -> ensureEditor editor, cursor: [3, 2]
-        setCursor(r1.end); previousItem(); runs -> ensureEditor editor, cursor: [3, 2]
-
-        setCursor(r2.start); nextItem(); runs -> ensureEditor editor, cursor: [2, 0]
-        setCursor(r2.end); nextItem(); runs -> ensureEditor editor, cursor: [2, 0]
-        setCursor(r2.start); previousItem(); runs -> ensureEditor editor, cursor: [0, 0]
-        setCursor(r2.end); previousItem(); runs -> ensureEditor editor, cursor: [0, 0]
-
-        setCursor(r3.start); nextItem(); runs -> ensureEditor editor, cursor: [3, 2]
-        setCursor(r3.end); nextItem(); runs -> ensureEditor editor, cursor: [3, 2]
-        setCursor(r3.start); previousItem(); runs -> ensureEditor editor, cursor: [1, 2]
-        setCursor(r3.end); previousItem(); runs -> ensureEditor editor, cursor: [1, 2]
-
-        setCursor(r4.start); nextItem(); runs -> ensureEditor editor, cursor: [0, 0]
-        setCursor(r4.end); nextItem(); runs -> ensureEditor editor, cursor: [0, 0]
-        setCursor(r4.start); previousItem(); runs -> ensureEditor editor, cursor: [2, 0]
-        setCursor(r4.end); previousItem(); runs -> ensureEditor editor, cursor: [2, 0]
+        ensureCursor = (point) -> runs -> ensureEditor(editor, cursor: point)
+
+        setCursor(r1[0]); nextItem(); ensureCursor([1, 2])
+        setCursor(r1[1]); nextItem(); ensureCursor([1, 2])
+        setCursor(r1[0]); previousItem(); ensureCursor([3, 2])
+        setCursor(r1[1]); previousItem(); ensureCursor([3, 2])
+
+        setCursor(r2[0]); nextItem(); ensureCursor([2, 0])
+        setCursor(r2[1]); nextItem(); ensureCursor([2, 0])
+        setCursor(r2[0]); previousItem(); ensureCursor([0, 0])
+        setCursor(r2[1]); previousItem(); ensureCursor([0, 0])
+
+        setCursor(r3[0]); nextItem(); ensureCursor([3, 2])
+        setCursor(r3[1]); nextItem(); ensureCursor([3, 2])
+        setCursor(r3[0]); previousItem(); ensureCursor([1, 2])
+        setCursor(r3[1]); previousItem(); ensureCursor([1, 2])
+
+        setCursor(r4[0]); nextItem(); ensureCursor([0, 0])
+        setCursor(r4[1]); nextItem(); ensureCursor([0, 0])
+        setCursor(r4[0]); previousItem(); ensureCursor([2, 0])
+        setCursor(r4[1]); previousItem(); ensureCursor([2, 0])
 
   describe "narrow-editor auto-sync selected-item to active editor", ->
     [editor2] = []

Ui = require '../lib/ui'
{Range} = require 'atom'
settings = require '../lib/settings'
{
  startNarrow

        ensure text: "\nabc\ndef\n"

      narrow.waitsForRefresh ->
        runCommand('narrow:refresh')

      runs ->
        ensure text: originalText

  describe "narrow:next-item, narrow:previous-item", ->
    nextItem = -> runs -> narrow.waitsForConfirm -> runCommand('narrow:next-item')
    previousItem = -> runs -> narrow.waitsForConfirm -> runCommand('narrow:previous-item')

    describe "basic behavior", ->
      beforeEach ->
