This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-9113-b636a805c6168a86fc5b9d526b0beec3c4236dae in repository https://gitbox.apache.org/repos/asf/texera.git
commit 98b875f812d7c5c9a69908d14df50c282c123550 Author: Xinyuan Lin <[email protected]> AuthorDate: Sun Oct 25 16:57:43 2026 +0000 refactor(frontend): remove dead breakpoint popup positioning (#9113) ### What changes were proposed in this PR? Removes `BreakpointConditionInputComponent.left()` and `top()`, two positioning methods that nothing in production calls. **−66 lines.** There is no behaviour change. The popup is positioned by `ngOnChanges`, which computes `topPosition` and `leftPosition` for the template's `[ngStyle]="{ top: topPosition, left: leftPosition }"` binding. The template never calls `left()` or `top()`. The component's one host, `code-debugger`, binds only its inputs and output, and the two parent `ViewChild` fields that reference the component are never read. Every import is still used. The spec loses the five cases that only exercised the two methods. Its coverage of the surviving positioning (`ngOnChanges`, `topPosition`, `leftPosition`) stays. ### History | | | | --- | --- | | **Introduced by** | #2953 (2024-10-25), "Add Udon breakpoint UI - breakpoint-related operations", in the same commit as the `[ngStyle]` positioning that is actually used | | **Usage removed by** | **never used**. Only spec cases (#7304, #7988) ever called them | They have been unused for the two years since they were added. ### Any related issues, documentation, discussions? Closes #9110 ### How was this PR tested? No new tests. The surviving positioning keeps its cases. From `frontend/`: - `npx ng test --watch=false --include='**/breakpoint-condition-input.component.spec.ts' --include='**/code-debugger.component.spec.ts' --include='**/code-editor.component.spec.ts'`: 3 files, 126 tests, all pass. The last two specs cover the component's host and the code editor that declares it. - `npx tsc --noEmit -p src/tsconfig.app.json` and `-p src/tsconfig.spec.json`: clean. - `yarn format:ci`: clean. - `npx ng build`: success. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- .../breakpoint-condition-input.component.spec.ts | 44 ---------------------- .../breakpoint-condition-input.component.ts | 22 ----------- 2 files changed, 66 deletions(-) diff --git a/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts b/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts index b96eac284d..c35c47ee76 100644 --- a/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts +++ b/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts @@ -54,7 +54,6 @@ describe("BreakpointConditionInputComponent", () => { }) as HTMLDivElement, getBottomForLineNumber: () => 40, getScrollTop: () => 5, - getScrollLeft: () => 0, dispose: vi.fn(), } as unknown as editor.IStandaloneCodeEditor; @@ -78,46 +77,6 @@ describe("BreakpointConditionInputComponent", () => { * expectation below is a specific number rather than a zero that jsdom would produce anyway. */ describe("popup placement", () => { - it("offsets left by the glyph margin and the fixed popup width", () => { - // 30 (rect.left) + 10 (glyphMarginLeft) - 0 (scrollLeft) - 160 (popup width) - expect(component.left()).toBe(-120); - }); - - it("places the top at the bottom of the target line, less the scroll offset", () => { - // 20 (rect.top) + 40 (line bottom) - 5 (scrollTop) - expect(component.top()).toBe(55); - }); - - it("subtracts the horizontal scroll offset", () => { - // Only left() reads scrollLeft; a copy-paste of top()'s body would miss this. - component.monacoEditor = { - ...component.monacoEditor, - getScrollLeft: () => 25, - } as unknown as editor.IStandaloneCodeEditor; - - expect(component.left()).toBe(-145); - }); - - it("falls back to 0 rather than throwing when there is no editor yet", () => { - const stub = component.monacoEditor; - component.monacoEditor = undefined as unknown as editor.IStandaloneCodeEditor; - try { - // The guards exist because the popup can be rendered a tick before the editor is attached. - expect(component.left()).toBe(0); - expect(component.top()).toBe(0); - } finally { - // afterEach disposes the editor, so put the stub back. - component.monacoEditor = stub; - } - }); - - it("falls back to 0 for top() when no line is targeted", () => { - component.lineNum = undefined; - expect(component.top()).toBe(0); - // left() does not depend on the line, so it still resolves. - expect(component.left()).toBe(-120); - }); - it("writes both css offsets when the target line changes", () => { mockUdfDebugService.getCondition.mockReturnValue("x > 1"); component.lineNum = 3; @@ -142,7 +101,6 @@ describe("BreakpointConditionInputComponent", () => { getDomNode: () => undefined, getBottomForLineNumber: () => 40, getScrollTop: () => 5, - getScrollLeft: () => 0, dispose: vi.fn(), } as unknown as editor.IStandaloneCodeEditor; component.lineNum = 3; @@ -156,8 +114,6 @@ describe("BreakpointConditionInputComponent", () => { expect(component.topPosition).toBe("35px"); // left: 0 (no rect) + 0 (glyph margin) - 160 (popup width) expect(component.leftPosition).toBe("-160px"); - // top() reaches the same missing rect through its own fallback. - expect(component.top()).toBe(35); }); it("defaults the condition to empty when the debugger holds none for that line", () => { diff --git a/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.ts b/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.ts index 4da98a74a6..e8fc56a94c 100644 --- a/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.ts +++ b/frontend/src/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.ts @@ -64,28 +64,6 @@ export class BreakpointConditionInputComponent implements OnChanges { this.leftPosition = `${leftValue}px`; } - public left(): number { - if (!isDefined(this.monacoEditor)) { - return 0; - } - - // Calculate the left position of the input popup based on the editor layout - const { glyphMarginLeft } = this.monacoEditor.getLayoutInfo()!; - const { left } = this.monacoEditor.getDomNode()!.getBoundingClientRect(); - return left + glyphMarginLeft - this.monacoEditor.getScrollLeft() - 160; - } - - public top(): number { - if (!(isDefined(this.monacoEditor) && isDefined(this.lineNum))) { - return 0; - } - - // Calculate the top position of the input popup based on the editor layout - const topPixel = this.monacoEditor.getBottomForLineNumber(this.lineNum); - const editorRect = this.monacoEditor.getDomNode()?.getBoundingClientRect(); - return (editorRect?.top || 0) + topPixel - this.monacoEditor.getScrollTop(); - } - get isVisible(): boolean { return isDefined(this.lineNum); }
