Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit cf695bd

Browse files
authored
chore: rm unused event-positions (#420)
1 parent 03ac028 commit cf695bd

File tree

3 files changed

+2
-43
lines changed

3 files changed

+2
-43
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"author": "Felix Becker <felix@sourcegraph.com>",
3232
"dependencies": {
33-
"@sourcegraph/event-positions": "^1.0.4",
3433
"@sourcegraph/extension-api-types": "^2.1.0",
3534
"lodash": "^4.17.10",
3635
"rxjs": "6.6.3",

src/testutils/mouse.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CharacterPositions } from '@sourcegraph/event-positions'
21
import { Position } from '@sourcegraph/extension-api-types'
32
import { convertNode } from '../token_position'
43
import { CodeViewProps } from './dom'
@@ -68,33 +67,3 @@ export const dispatchMouseEventAtPositionImpure = (
6867
characterOffset += value.length
6968
}
7069
}
71-
72-
/**
73-
* Dispatch a click event at a position in the code view.
74-
*
75-
* @param codeViewProps the CodeViewProps from the generated test cases
76-
* @param position the 0-indexed position to click
77-
*/
78-
export const clickPosition = ({ codeView, getCodeElementFromLineNumber }: CodeViewProps, position: Position): void => {
79-
const line = getCodeElementFromLineNumber(codeView, position.line)
80-
if (!line) {
81-
throw new Error(invalidPosition(position, 'Line not found'))
82-
}
83-
84-
const positions = new CharacterPositions(line)
85-
86-
const left = positions.getCharacterOffset(position.character, line, true)
87-
const right = positions.getCharacterOffset(position.character, line, false)
88-
const width = right - left
89-
90-
const rect = line.getBoundingClientRect()
91-
const top = rect.top
92-
const height = rect.height
93-
94-
const event = createMouseEvent('click', {
95-
x: left + width / 2,
96-
y: top + height / 2,
97-
})
98-
99-
line.dispatchEvent(event)
100-
}

yarn.lock

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,7 @@
485485
eslint-plugin-react-hooks "^4.0.0"
486486
eslint-plugin-rxjs "^0.0.2-beta.20"
487487

488-
"@sourcegraph/event-positions@^1.0.4":
489-
version "1.0.4"
490-
resolved "https://registry.npmjs.org/@sourcegraph/event-positions/-/event-positions-1.0.4.tgz#031541374b725cfb0cbefaa07add020b1a119a60"
491-
integrity sha512-mrWIEpC9UuAZwExMQlRfLaLLwC9x8WQMAOEYFHGEdXCzXEHqaZu22aR8PtrQEMtwia6eIzvZl6uYp0gDDGLo2g==
492-
dependencies:
493-
"@sourcegraph/extension-api-types" "^2.0.0"
494-
lodash "^4.17.10"
495-
rxjs "^6.3.2"
496-
497-
"@sourcegraph/extension-api-types@^2.0.0", "@sourcegraph/extension-api-types@^2.1.0":
488+
"@sourcegraph/extension-api-types@^2.1.0":
498489
version "2.1.0"
499490
resolved "https://registry.npmjs.org/@sourcegraph/extension-api-types/-/extension-api-types-2.1.0.tgz#dcc81eba70371c9aabc7333361f5e1ed63e7c91e"
500491
integrity sha512-KWxkyphmlwam8kfYPSmoitKQRMGQCsr1ZRmNZgijT7ABKaVyk/+I5ezt2J213tM04Hi0vyg4L7iH1VCkNvm2Jw==
@@ -7694,7 +7685,7 @@ run-queue@^1.0.0, run-queue@^1.0.3:
76947685
dependencies:
76957686
aproba "^1.1.1"
76967687

7697-
rxjs@6.6.3, rxjs@^6.3.2:
7688+
rxjs@6.6.3:
76987689
version "6.6.3"
76997690
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
77007691
integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==

0 commit comments

Comments
 (0)