         [gutterNode] = []
 
         buildClickEvent = (target) ->
-          # FIXME: I could not get the simulated event to set the target. I tried several things, and was unable to get it set.
-          # buildMouseEvent('click', {target})
-          {target, type: 'click', bubbles: true, cancelable: true}
+          buildMouseEvent('click', {target})
 
         beforeEach ->
           gutterNode = node.querySelector('.gutter')
 
         it "folds and unfolds the block represented by the fold indicator when clicked", ->
-          lineNumber = gutterNode.querySelectorAll('.line-number')[2] # bufferRow 1
-          expect(lineNumberHasClass(lineNumber, 'folded')).toBe false
-
+          expect(lineNumberHasClass(1, 'folded')).toBe false
+
+          lineNumber = component.lineNumberNodeForScreenRow(1)
           target = lineNumber.querySelector('.icon-right')
-          # target.dispatchEvent(buildClickEvent(target))
-          component.onClickGutter(buildClickEvent(target))
-          lineNumber = gutterNode.querySelectorAll('.line-number')[2] # bufferRow 1
-          expect(lineNumberHasClass(lineNumber, 'folded')).toBe true
-
+
+          target.dispatchEvent(buildClickEvent(target))
+          expect(lineNumberHasClass(1, 'folded')).toBe true
+
+          lineNumber = component.lineNumberNodeForScreenRow(1)
           target = lineNumber.querySelector('.icon-right')
-          # target.dispatchEvent(buildClickEvent(target))
-          component.onClickGutter(buildClickEvent(target))
-          lineNumber = gutterNode.querySelectorAll('.line-number')[2] # bufferRow 1
-          expect(lineNumberHasClass(lineNumber, 'folded')).toBe false
+
+          target.dispatchEvent(buildClickEvent(target))
+          expect(lineNumberHasClass(1, 'folded')).toBe false
 
         it "does not fold when the line number node is clicked", ->
-          lineNumber = gutterNode.querySelectorAll('.line-number')[2]
-          component.onClickGutter(buildClickEvent(lineNumber))
-          lineNumber = gutterNode.querySelectorAll('.line-number')[2]
-          expect(lineNumberHasClass(lineNumber, 'folded')).toBe false
+          component.onClickGutter(buildClickEvent(component.lineNumberNodeForScreenRow(1)))
+          expect(lineNumberHasClass(1, 'folded')).toBe false
 
     describe "when decorations are used", ->
       describe "when decorations are applied to buffer rows", ->

        editor.setCursorBufferPosition([0, Infinity])
        wrapperView.show()
        expect(node.querySelector('.cursor').style['-webkit-transform']).toBe "translate3d(#{9 * charWidth}px, 0px, 0px)"

      clientX = scrollViewClientRect.left + positionOffset.left - editor.getScrollLeft()
      clientY = scrollViewClientRect.top + positionOffset.top - editor.getScrollTop()
      {clientX, clientY}

  describe "focus handling", ->
    inputNode = null
