       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(wrapper.screenLineForRow(7).text).toBe '      current < pivot ? '
+          expect(wrapper.screenLineForRow(8).text).toBe 'left1234567890.push(current) : '
+          expect(wrapper.screenLineForRow(9).text).toBe 'right.push(current);'
+          expect(wrapper.screenLineForRow(10).text).toBe '    }'
 
           expect(changeHandler).toHaveBeenCalled()
           [event] = changeHandler.argsForCall[0]

      describe "when the number of screen lines remains the same for the changed buffer line", ->
        it "re-wraps the existing lines and emits a change event for all its screen lines", ->
          buffer.insert([6, 28], '1234567')
          expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe '      current < pivot ? left1234567.push(current) '
          expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe ': right.push(current);'
          expect(tokensText(wrapper.screenLineForRow(9).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]
