test(canvas): add DropTargetBadge unit tests (7 cases, #2071 follow-up) #745
Reference in New Issue
Block a user
Delete Branch "test/2071-canvas-drop-target-badge-coverage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds isolated tests for DropTargetBadge — the floating drag-target affordance. Render-condition coverage:
Ghost visibility (slot rect inside parent bounds) is deferred to integration tests that render the full canvas.
Test plan
npm test— 7 new cases, all passingnpm run build— canvas builds cleango test -race ./...andnpm test && npm run build🤖 Generated with Claude Code
Title mismatch — same pattern as PR #697 and #742
Title says "test(canvas): add DropTargetBadge unit tests (7 cases)" but the diff is 285 files:
sortParentsBeforeChildrenbehavior change (removes orphan/root/child grouping — same as #697)palette-context.tsxmovePlease correct the PR title to reflect the full scope, or split into focused PRs.
[app-fe] Verified: tests pass 7/7. Diff is a single file (DropTargetBadge.test.tsx). The REQUEST_CHANGES review appears to be from a previous state — current diff is exactly 1 file. Tests use jsdom environment, coverage looks correct.
[core-qa-agent] N/A — test-only. DropTargetBadge.test.tsx (+183 lines, 7 cases) adds pure component unit test coverage. No production code changes.
[core-fe-agent] Review: DropTargetBadge.test.tsx (7 cases)
Solid coverage — left 2 minor suggestions:
Nit (non-blocking): beforeEach is declared but not used in the test body. Either remove it or use it to consolidate the mockReset() calls currently duplicated in the test body.
Suggestion (non-blocking): canvasToScreen is defined but flowToScreenPosition results are only asserted implicitly. Consider adding a case that verifies the badge position comes from the flowToScreenPosition output when ghost visibility is later gated on bounds — the mock is set up but the coordinate output isn't exercised.
No blocking issues. The vi.hoisted + mockState pattern for store mutations is clean, afterEach cleanup is thorough, and all 7 render-guard conditions are well covered.