From bc391094df0026c41bc2a4ae31bcb70198c5a0b1 Mon Sep 17 00:00:00 2001 From: Ben Ogle & Nathan Sobo Date: Wed, 18 Jun 2014 16:52:31 -0700 Subject: [PATCH] :lipstick: Move helper --- spec/editor-component-spec.coffee | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index fd068f656..b11d523d1 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -916,7 +916,7 @@ describe "EditorComponent", -> expect(inputNode.offsetTop).toBe 0 expect(inputNode.offsetLeft).toBe 0 - describe "mouse interactions", -> + describe "mouse interactions on the scrollView", -> linesNode = null beforeEach -> @@ -1017,12 +1017,6 @@ describe "EditorComponent", -> linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([4, 8]), {target})) expect(editor.isFoldedAtBufferRow 4).toBe false - 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} describe "focus handling", -> inputNode = null @@ -1443,3 +1437,11 @@ describe "EditorComponent", -> 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} +