aglinxinyuan opened a new pull request, #7304:
URL: https://github.com/apache/texera/pull/7304
### What changes were proposed in this PR?
Two workspace editor sub-components whose specs stopped early.
| Component | Before | Tests now |
|---|---|---|
| `codearea-custom-template` | 64.5%, one "should create" test | 6 |
| `breakpoint-condition-input` | 63.9%, condition + keyboard paths | 13 |
**`CodeareaCustomTemplateComponent`** had a single creation test. Its actual
job is keeping one shared, per-operator "is the editor open" flag in sync
across three inputs — this component opening or closing the editor, a co-editor
opening the same one remotely, and the component being torn down while the
editor is still up. The flag lives in `CodeEditorService` keyed by operator id,
so a mix-up there silently reopens the wrong operator's editor.
Also pinned: `ngOnDestroy` persists the **current** flag rather than a
hardcoded false (so a component torn down with its editor up comes back open),
and the created editor is handed **this field's** form control rather than a
fresh one — otherwise the dialog opens detached from the property it is meant
to edit.
The co-editor test stubs `getCoeditorOpenedCodeEditorSubject` and builds its
own fixture, because the component subscribes in its **constructor** and that
getter returns `asObservable()`. Casting the result back to a `Subject` would
only work by accident of the current implementation — the same trap that came
up in review on the mini-map spec.
**`BreakpointConditionInputComponent`**'s popup has no layout of its own; it
is positioned by arithmetic over Monaco's reported geometry, and none of
`left()`, `top()`, `isVisible` or the css offsets written by `ngOnChanges` was
tested. The existing stub supplies distinguishable non-zero values, so every
new expectation is a specific number —
```
left() = 30 (rect.left) + 10 (glyphMarginLeft) - 0 (scrollLeft) - 160 (popup
width) = -120
top() = 20 (rect.top) + 40 (line bottom) - 5 (scrollTop)
= 55
```
— rather than a zero that jsdom would produce anyway. Also covers both the
no-editor and no-line guards, and the horizontal scroll offset that only
`left()` reads (so a copy-paste of `top()`'s body would be caught).
`code-debugger.component.ts` (20 missed) is deliberately out of scope: its
spec already has 16 tests covering the decoration and status-change handlers,
and the residue looked like it would need padding rather than real assertions.
Said plainly rather than quietly skipped.
No production file is touched.
### Any related issues, documentation, discussions?
Closes #7301
### How was this PR tested?
```
npx ng test --watch=false
--include="**/codearea-custom-template.component.spec.ts"
--include="**/breakpoint-condition-input.component.spec.ts"
```
```
✓ .../breakpoint-condition-input.component.spec.ts (13 tests)
✓ .../codearea-custom-template.component.spec.ts (6 tests)
Test Files 2 passed (2)
```
`yarn format:ci` passes (prettier-eslint + eslint), which Vitest does not
cover on its own — it flagged both files on the first attempt.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]