     describe "when buffer lines are inserted", ->
       it "re-wraps existing and new screen lines and emits a change event", ->
         buffer.insert([6, 21], '1234567890 abcdefghij 1234567890\nabcdefghij')
-        expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe '      current < pivot1234567890 abcdefghij '
-        expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe '1234567890'
-        expect(tokensText(wrapper.screenLineForRow(9).tokens)).toBe 'abcdefghij ? left.push(current) : '
-        expect(tokensText(wrapper.screenLineForRow(10).tokens)).toBe 'right.push(current);'
+        expect(wrapper.screenLineForRow(7).text).toBe '      current < pivot1234567890 abcdefghij '
+        expect(wrapper.screenLineForRow(8).text).toBe '1234567890'
+        expect(wrapper.screenLineForRow(9).text).toBe 'abcdefghij ? left.push(current) : '
+        expect(wrapper.screenLineForRow(10).text).toBe 'right.push(current);'
 
         expect(changeHandler).toHaveBeenCalled()
         [event] = changeHandler.argsForCall[0]

      describe "when the number of screen lines increases for the changed buffer line", ->
        it "re-wraps and adds an additional screen line and emits a change event for all screen lines", ->
          buffer.insert([6, 28], '1234567890')
          expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe '      current < pivot ? '
          expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe 'left1234567890.push(current) : '
          expect(tokensText(wrapper.screenLineForRow(9).tokens)).toBe 'right.push(current);'
          expect(tokensText(wrapper.screenLineForRow(10).tokens)).toBe '    }'

          expect(changeHandler).toHaveBeenCalled()
          [event] = changeHandler.argsForCall[0]

    describe "when buffer lines are removed", ->
      it "removes screen lines and emits a change event", ->
        buffer.change(new Range([3, 21], [7, 5]), ';')
        expect(wrapper.screenLineForRow(3).text).toBe '    var pivot = items;'
        expect(wrapper.screenLineForRow(4).text).toBe '    return '
        expect(wrapper.screenLineForRow(5).text).toBe 'sort(left).concat(pivot).concat(sort(right));'
        expect(wrapper.screenLineForRow(6).text).toBe '  };'

        expect(changeHandler).toHaveBeenCalled()
        [event] = changeHandler.argsForCall[0]
