aglinxinyuan opened a new pull request, #7951:
URL: https://github.com/apache/texera/pull/7951
### What changes were proposed in this PR?
`findIntersectedLink`'s loop body had never executed: every existing call
site either has no links, no attached paper, or mocks the method out. It
decides whether dropping an operator onto an edge splices it into that edge.
Adds 6 tests driving it against a real joint paper with a rendered link: the
edge found when the drop lands on it, nothing found when the drop is far away
or the canvas has no links, and the three defensive `continue`s each yielding
no edge rather than throwing.
jsdom implements no SVG path geometry, so
`getTotalLength`/`getPointAtLength` are installed on the rendered `.connection`
path, exactly as the existing `doesOperatorIntersectPath` tests already do.
Everything the loop itself does — model lookup, view lookup, path lookup, the
early continues — stays real.
**Verified by mutation**, all reverted (production diff empty):
| Mutation | Result |
|---|---|
| missing view no longer skipped | red |
| missing drawn path no longer skipped | red |
| intersection result inverted | red |
| always reports an intersection | red |
| never reports an intersection | red |
| wrong path selector | red |
| missing **model** no longer skipped | **survived — see below** |
### A redundant guard
Removing `if (!jointLink) continue` changes nothing observable:
`paper.findViewByModel(undefined)` returns `undefined`, so the very next guard
(`if (!linkView) continue`) catches the same case and the function still
returns `null`. The first guard is defensive but subsumed by the second.
No test can distinguish the two implementations, so this is reported rather
than papered over with a contrived assertion. Removing it would be a small,
separate cleanup.
No production file is touched.
### Measured on current main
This work was built on 2026-08-09 and sat unpushed. It has been rebased onto
current main and **re-measured rather than trusted**. Coverage of
`drag-drop.service.ts`, via `ng test --coverage --coverage-reporters=lcovonly`
with the same spec filter on both sides:
| Metric | Before | After |
|---|---|---|
| Lines hit | 186/193 | **191/193** |
| Fully covered (Codecov's metric) | 179 | **185** |
| Missed branch arms | 11 | **6** |
So **+6 fully-covered lines and +5 branch arms.** Tests 18 → 24; the branch
was written against 17, and main has since gained one.
Worth noting the cases still hold after #7512 removed two pieces of
unreachable code in this same file — the guards these tests pin are not among
what it deleted.
### Any related issues, documentation, discussions?
Closes #7950
### How was this PR tested?
```
npx ng test --watch=false --include="**/drag-drop.service.spec.ts"
```
```
Test Files 1 passed (1)
Tests 24 passed (24)
```
jsdom prints `HTMLCanvasElement.prototype.getContext` warnings throughout.
Those are jointjs rendering into jsdom and appear identically on the untouched
baseline. `yarn format:ci` passes.
### 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]