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

Commit aed13ca

Browse files
ijsnowfelixfbecker
authored andcommitted
refactor: remove unused test utility helper
1 parent 005604f commit aed13ca

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

src/testutils/dom.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,8 @@ export interface CodeViewProps extends DOMFunctions {
4040
container: HTMLElement
4141
/** The revision and repository information for the file used in the generated test cases. */
4242
revSpec: typeof TEST_DATA_REVSPEC
43-
/** A helper method for adding rows to the test case. */
44-
insertRow: (text: string) => HTMLElement
4543
}
4644

47-
export const wrapCharsInSpans = (line: string) =>
48-
Array.from(line)
49-
.map((c, j) => `<span data-char="${j}">${c}</span>`)
50-
.join('')
51-
5245
// BEGIN setup test cases
5346

5447
const getDiffCodePart = (codeElement: HTMLElement): 'new' | 'old' | undefined => {
@@ -120,25 +113,6 @@ const createGitHubCodeView = (): CodeViewProps => {
120113
getCodeElementFromLineNumber,
121114
getLineNumberFromCodeElement,
122115
getDiffCodePart,
123-
124-
insertRow: (text: string) => {
125-
const lastRow = codeView.querySelector('tbody tr:last-of-type')!
126-
127-
const node = lastRow.cloneNode(true) as HTMLElement
128-
const line = parseInt((lastRow.children.item(0) as HTMLElement).dataset.lineNumber as string, 10) + 1
129-
130-
const lineNode = node.children.item(0)! as HTMLElement
131-
lineNode.id = `L${line}`
132-
lineNode.dataset.lineNumber = line.toString()
133-
134-
const codeNode = node.children.item(1)! as HTMLElement
135-
codeNode.id = `LC${line}`
136-
codeNode.innerHTML = wrapCharsInSpans(text)
137-
138-
codeView.querySelector('tbody')!.appendChild(node)
139-
140-
return node
141-
},
142116
}
143117
}
144118

@@ -201,22 +175,6 @@ const createSourcegraphCodeView = (): CodeViewProps => {
201175
getCodeElementFromLineNumber,
202176
getLineNumberFromCodeElement,
203177
getDiffCodePart,
204-
insertRow: (text: string) => {
205-
const lastRow = codeView.querySelector('tbody tr:last-of-type')!
206-
207-
const node = lastRow.cloneNode(true) as HTMLElement
208-
const line = parseInt((lastRow.children.item(0) as HTMLElement).dataset.line as string, 10) + 1
209-
210-
const lineNode = node.children.item(0)! as HTMLElement
211-
lineNode.dataset.line = line.toString()
212-
213-
const codeNode = node.children.item(1)! as HTMLElement
214-
codeNode.innerHTML = wrapCharsInSpans(text)
215-
216-
codeView.querySelector('tbody')!.appendChild(node)
217-
218-
return node
219-
},
220178
}
221179
}
222180

0 commit comments

Comments
 (0)