       expect(gutterNode.offsetWidth).toBe initialGutterWidth
 
     fdescribe "when decorations are used", ->
+      {lineHasClass, gutter} = {}
+      beforeEach ->
+        gutter = component.refs.gutter
+        lineHasClass = (screenRow, klass) ->
+          component.lineNumberNodeForScreenRow(screenRow).classList.contains(klass)
+
       it "renders the gutter-class decorations", ->
         node.style.height = 4.5 * lineHeightInPixels + 'px'
         component.measureScrollView()

        node.style.width = 30 * charWidth + 'px'
        component.measureScrollView()

        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'no-wrap').toBeTruthy()
        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'wrap-me').toBeTruthy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'no-wrap').toBeFalsy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'wrap-me').toBeTruthy()

        # should remove the wrapped decorations
        editor.removeDecorationForBufferRow(1, {type: 'gutter-class', class: 'no-wrap'})
        editor.removeDecorationForBufferRow(1, {type: 'gutter-class', class: 'wrap-me'})
        advanceClock(gutter.decorationRenderDelay)

        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'no-wrap').toBeFalsy()
        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'wrap-me').toBeFalsy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'no-wrap').toBeFalsy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'wrap-me').toBeFalsy()

        # should add them back when the nodes are not recreated
        editor.addDecorationForBufferRow(1, {type: 'gutter-class', class: 'no-wrap'})
        editor.addDecorationForBufferRow(1, {type: 'gutter-class', class: 'wrap-me', softWrap: true})
        advanceClock(gutter.decorationRenderDelay)

        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'no-wrap').toBeTruthy()
        expect(component.lineNumberNodeForScreenRow(2).classList.contains 'wrap-me').toBeTruthy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'no-wrap').toBeFalsy()
        expect(component.lineNumberNodeForScreenRow(3).classList.contains 'wrap-me').toBeTruthy()

  describe "cursor rendering", ->
    it "renders the currently visible cursors, translated relative to the scroll position", ->

        verticalScrollbarNode.scrollTop = 2.5 * lineHeightInPixels
        verticalScrollbarNode.dispatchEvent(new UIEvent('scroll'))

        expect(lineHasClass(9, 'fancy-class')).toBeTruthy()
        expect(lineHasClass(9, 'nope-class')).toBeFalsy()

      it "handles updates to gutter-class decorations", ->
        editor.addDecorationForBufferRow(2, {type: 'gutter-class', class: 'fancy-class'})
        editor.addDecorationForBufferRow(2, {type: 'someother-type', class: 'nope-class'})

        advanceClock(gutter.decorationRenderDelay)

        expect(lineHasClass(2, 'fancy-class')).toBeTruthy()
        expect(lineHasClass(2, 'nope-class')).toBeFalsy()

        editor.removeDecorationForBufferRow(2, {type: 'gutter-class', class: 'fancy-class'})
        editor.removeDecorationForBufferRow(2, {type: 'someother-type', class: 'nope-class'})

        advanceClock(gutter.decorationRenderDelay)

        expect(lineHasClass(2, 'fancy-class')).toBeFalsy()
        expect(lineHasClass(2, 'nope-class')).toBeFalsy()

      it "handles softWrap decorations", ->
        editor.addDecorationForBufferRow(1, {type: 'gutter-class', class: 'no-wrap'})
        editor.addDecorationForBufferRow(1, {type: 'gutter-class', class: 'wrap-me', softWrap: true})

