mengw15 opened a new pull request, #6830:
URL: https://github.com/apache/texera/pull/6830

   ### What changes were proposed in this PR?
   
   Extends the existing `JointGraphWrapper` spec to cover the remaining
   unit-testable (non-rendering) methods
   
(`frontend/src/app/workspace/service/workflow-graph/model/joint-graph-wrapper.ts`).
   The wrapper is built over a headless `new joint.dia.Graph()` with no
   `dia.Paper`, matching the spec's existing setup. No production code was 
changed.
   
   19 tests, grouped by the families the issue lists:
   
   **Highlighting** — `highlightLinks` / `unhighlightLinks`,
   `highlightCommentBoxes` / `unhighlightCommentBoxes`, `highlightPorts` /
   `unhighlightPorts`, each asserted through the matching
   `getCurrentHighlighted*IDs` getter *and* its highlight/unhighlight stream;
   single-select (the default) dropping the previous highlight vs 
`setMultiSelectMode(true)`
   keeping it; `getCurrentHighlights` / `getCurrentHighlightedIDs` aggregation
   (ports are deliberately excluded from the latter); `unhighlightElements`
   clearing all four families; and the group highlight streams, which operator
   highlighting does not touch.
   
   **Flags** — `setReloadingWorkflow` / `getReloadingWorkflow` and
   `setListenPositionChange` / `getListenPositionChange` round-trips.
   
   **Zoom** — `setZoomProperty` updating the ratio and emitting on the zoom 
stream,
   `isZoomRatioMin` / `isZoomRatioMax` at the configured bounds, and
   `restoreDefaultZoomAndOffset` resetting to `INIT_ZOOM_VALUE` while 
signalling a
   paper-offset restore.
   
   **Cell layer / breakpoints / position** — `getCellLayer` (z index, and the 
throw
   for an unknown cell), `getLinkIDsWithBreakpoint`, and
   `getElementPositionChangeEvent` reporting a moved element's old/new position.
   
   **Coeditor presence** — `addCoeditorOperatorHighlight` /
   `deleteCoeditorOperatorHighlight`, `setCurrentEditing` / 
`removeCurrentEditing`,
   and `setPropertyChanged` / `removePropertyChanged`. These reach the canvas
   through `getMainJointPaper()?.`, so with no paper attached they must degrade 
to a
   safe no-op; `setCurrentEditing` additionally returns a 300 ms interval, so 
the
   test drives it under `vi.useFakeTimers()` and asserts `removeCurrentEditing`
   clears it (real timers restored in a `finally`).
   
   Two behaviours are asserted as the code actually behaves rather than as the 
issue
   describes them, and are commented in the spec:
   
   - `setZoomProperty` does **not** clamp — `isZoomRatioMin/Max` only *report* 
where
     the ratio sits relative to `ZOOM_MINIMUM` / `ZOOM_MAXIMUM`; clamping is the
     caller's job.
   - the port streams emit **unconditionally**, so single-select's "clear the
     previous ports first" step surfaces as an extra empty batch on the 
unhighlight
     stream.
   
   Out of scope per the issue (they need a real `dia.Paper` / geometry):
   `attachMainJointPaper` / `getMainJointPaper`, `autoLayoutJoint`,
   `getElementPosition` / `setElementPosition` / `setAbsolutePosition`,
   `restorePaperOffset`.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6825
   
   ### How was this PR tested?
   
   Extended unit tests, run locally in `frontend/` (all green; the failure path 
was
   verified by breaking an assertion to confirm the suite goes red):
   
   ```
   ng test --watch=false --include 
src/app/workspace/service/workflow-graph/model/joint-graph-wrapper.spec.ts
   # Test Files 1 passed (1) | Tests 47 passed (47)
   prettier --write <spec>   # clean
   eslint  <spec>            # clean
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
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]

Reply via email to