test: add unit tests for HTMLTooltip mark (#164)#499
Merged
Conversation
Add 8 tests covering tooltip visibility, datum selection, positioning, pointer events, and edge cases. Guard against missing quadtree when data is empty. Fix event listener cleanup (mouseleave → pointerleave). Co-Authored-By: Claude Opus 4.6 <[email protected]>
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Type the datum generic via ComponentProps<typeof HTMLTooltip<Datum>>
to fix "Property 'label' does not exist on type '{}'" errors
- Remove unused @ts-expect-error directive on test import
- Include oxlint auto-fixes in vector example files
Co-Authored-By: Claude Opus 4.6 <[email protected]>
tsc reports "no default export" for .svelte imports while svelte-check resolves them fine. Use @ts-ignore (accepted by both) instead of @ts-expect-error (rejected by svelte-check as unused). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Map.get() returns T | undefined, which svelte-check rejects for spread.
Using `as object` avoids oxlint's no-useless-fallback-in-spread rule
(which strips `?? {}` via --fix) while satisfying the type constraint.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTMLTooltipmark covering tooltip visibility, datum selection, positioning, pointer events, and edge casesdatais empty (missing quadtree at facet index)mouseleave→pointerleave)Test cases
.svelteplot-tooltiphashideclass, no contenthideremoved, content renderedhiderestored, content gonedata-labelattributestyle.left/style.topcorrectBug fixes
HTMLTooltip.svelte:57for whentrees[facetIndex]is undefined (empty data case). Without this, dispatching apointermoveevent with empty tooltip data causes aTypeError: Cannot read properties of undefined (reading 'find').HTMLTooltip.svelte:76: was removing'mouseleave'but should remove'pointerleave'(matching what was added on line 72). This caused a listener leak on component teardown.Test plan
🤖 Generated with Claude Code