From cf695bd5abd256eb4c15ff5f4ad38d9ab7f90e78 Mon Sep 17 00:00:00 2001 From: Chris Wendt Date: Mon, 22 Nov 2021 19:11:20 -0700 Subject: [PATCH] chore: rm unused event-positions (#420) --- package.json | 1 - src/testutils/mouse.ts | 31 ------------------------------- yarn.lock | 13 ++----------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/package.json b/package.json index 6c7d68b1..88ccc0e2 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ }, "author": "Felix Becker ", "dependencies": { - "@sourcegraph/event-positions": "^1.0.4", "@sourcegraph/extension-api-types": "^2.1.0", "lodash": "^4.17.10", "rxjs": "6.6.3", diff --git a/src/testutils/mouse.ts b/src/testutils/mouse.ts index 37d6e9c4..b9e59fad 100644 --- a/src/testutils/mouse.ts +++ b/src/testutils/mouse.ts @@ -1,4 +1,3 @@ -import { CharacterPositions } from '@sourcegraph/event-positions' import { Position } from '@sourcegraph/extension-api-types' import { convertNode } from '../token_position' import { CodeViewProps } from './dom' @@ -68,33 +67,3 @@ export const dispatchMouseEventAtPositionImpure = ( characterOffset += value.length } } - -/** - * Dispatch a click event at a position in the code view. - * - * @param codeViewProps the CodeViewProps from the generated test cases - * @param position the 0-indexed position to click - */ -export const clickPosition = ({ codeView, getCodeElementFromLineNumber }: CodeViewProps, position: Position): void => { - const line = getCodeElementFromLineNumber(codeView, position.line) - if (!line) { - throw new Error(invalidPosition(position, 'Line not found')) - } - - const positions = new CharacterPositions(line) - - const left = positions.getCharacterOffset(position.character, line, true) - const right = positions.getCharacterOffset(position.character, line, false) - const width = right - left - - const rect = line.getBoundingClientRect() - const top = rect.top - const height = rect.height - - const event = createMouseEvent('click', { - x: left + width / 2, - y: top + height / 2, - }) - - line.dispatchEvent(event) -} diff --git a/yarn.lock b/yarn.lock index 8db93605..0632e1b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -485,16 +485,7 @@ eslint-plugin-react-hooks "^4.0.0" eslint-plugin-rxjs "^0.0.2-beta.20" -"@sourcegraph/event-positions@^1.0.4": - version "1.0.4" - resolved "https://registry.npmjs.org/@sourcegraph/event-positions/-/event-positions-1.0.4.tgz#031541374b725cfb0cbefaa07add020b1a119a60" - integrity sha512-mrWIEpC9UuAZwExMQlRfLaLLwC9x8WQMAOEYFHGEdXCzXEHqaZu22aR8PtrQEMtwia6eIzvZl6uYp0gDDGLo2g== - dependencies: - "@sourcegraph/extension-api-types" "^2.0.0" - lodash "^4.17.10" - rxjs "^6.3.2" - -"@sourcegraph/extension-api-types@^2.0.0", "@sourcegraph/extension-api-types@^2.1.0": +"@sourcegraph/extension-api-types@^2.1.0": version "2.1.0" resolved "https://registry.npmjs.org/@sourcegraph/extension-api-types/-/extension-api-types-2.1.0.tgz#dcc81eba70371c9aabc7333361f5e1ed63e7c91e" integrity sha512-KWxkyphmlwam8kfYPSmoitKQRMGQCsr1ZRmNZgijT7ABKaVyk/+I5ezt2J213tM04Hi0vyg4L7iH1VCkNvm2Jw== @@ -7694,7 +7685,7 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@6.6.3, rxjs@^6.3.2: +rxjs@6.6.3: version "6.6.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==