       Object.defineProperty(event, 'target', get: -> properties.target)
       Object.defineProperty(event, 'srcObject', get: -> properties.target)
     event
+
+  clientCoordinatesForScreenPosition = (screenPosition) ->
+    positionOffset = editor.pixelPositionForScreenPosition(screenPosition)
+    scrollViewClientRect = node.querySelector('.scroll-view').getBoundingClientRect()
+    clientX = scrollViewClientRect.left + positionOffset.left - editor.getScrollLeft()
+    clientY = scrollViewClientRect.top + positionOffset.top - editor.getScrollTop()
+    {clientX, clientY}
+

      expect(inputNode.offsetTop).toBe 0
      expect(inputNode.offsetLeft).toBe 0

  describe "mouse interactions", ->
    linesNode = null

    beforeEach ->

          linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([4, 8]), {target}))
          expect(editor.isFoldedAtBufferRow 4).toBe false


  describe "focus handling", ->
    inputNode = null
