Skip to content

Commit b9c730e

Browse files
author
ntwigg
committed
Minor cleanup.
1 parent 7ad747d commit b9c730e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

browser-extension/src/datamodel/registries.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CommentEnhancer, CommentSpot } from './enhancer'
33
import { GitHubEnhancer } from './enhancers/github'
44

55
export interface EnhancedTextarea<T extends CommentSpot = CommentSpot> {
6-
element: HTMLTextAreaElement
6+
textarea: HTMLTextAreaElement
77
spot: T
88
handler: CommentEnhancer<T>
99
overtype: OverType
@@ -36,7 +36,7 @@ export class EnhancerRegistry {
3636
const result = handler.tryToEnhance(textarea)
3737
if (result) {
3838
const [overtype, spot] = result
39-
return { element: textarea, handler, overtype, spot }
39+
return { handler, overtype, spot, textarea }
4040
}
4141
} catch (error) {
4242
console.warn('Handler failed to identify textarea:', error)
@@ -58,7 +58,7 @@ export class TextareaRegistry {
5858
private textareas = new Map<HTMLTextAreaElement, EnhancedTextarea<any>>()
5959

6060
register<T extends CommentSpot>(textareaInfo: EnhancedTextarea<T>): void {
61-
this.textareas.set(textareaInfo.element, textareaInfo)
61+
this.textareas.set(textareaInfo.textarea, textareaInfo)
6262
// TODO: register as a draft in progress with the global list
6363
}
6464

browser-extension/tests/datamodel/enhancers/github.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('GitHubHandler', () => {
4343
const enhancedTextarea = enhancers.tryToEnhance(mockTextarea)
4444

4545
expect(enhancedTextarea).toBeTruthy()
46-
expect(enhancedTextarea?.element).toBe(mockTextarea)
46+
expect(enhancedTextarea?.textarea).toBe(mockTextarea)
4747
expect(enhancedTextarea?.spot.type).toBe('GH_PR_ADD_COMMENT')
4848

4949
// Register the enhanced textarea
@@ -54,7 +54,7 @@ describe('GitHubHandler', () => {
5454
// Verify it's in the registry
5555
const registeredTextarea = enhancedTextareas.get(mockTextarea)
5656
expect(registeredTextarea).toBeTruthy()
57-
expect(registeredTextarea?.element).toBe(mockTextarea)
57+
expect(registeredTextarea?.textarea).toBe(mockTextarea)
5858
})
5959

6060
it('should create correct GitHubContext spot for PR comment', () => {

0 commit comments

Comments
 (0)