test(ui): full component test coverage — 48% → 97% statements, 226 tests#5
Merged
Merged
Conversation
The coverage include list only counted src/components, so the i18n merge logic and lib/utils helpers were invisible in reports. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds 18 test files and extends 2, +152 tests (74 -> 226), written against rendered behavior: roles, aria wiring, keyboard/pointer interaction, and callback props — no snapshots, no CSS assertions. - Base UI overlays: dialog, popover, tooltip, sheet, dropdown-menu - Base UI primitives: accordion, select, switch, tabs, separator, scroll-area, navigation-menu (covers the extracted *-variants.ts too) - Docs components: breadcrumbs, callout, page-footer-nav, command-palette, elide-logo markOnly branch, theme-provider (storage/OS-preference/toggle) - Logic: lib/utils cn + keyed, i18n default + deep-merge, code-block editor/terminal/Prism paths, api-method signature branches, table-of-contents scroll-spy via a captured IntersectionObserver stub jsdom gaps are stubbed per-file (PointerEvent, ResizeObserver, matchMedia, an in-memory localStorage — Node's built-in shadows jsdom's); ScrollArea's scrollbar/thumb need real layout to mount, so only its render paths are asserted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
===========================================
+ Coverage 83.61% 97.72% +14.11%
===========================================
Files 38 38
Lines 659 659
Branches 279 263 -16
===========================================
+ Hits 551 644 +93
+ Misses 108 15 -93
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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
Test generation pass over
@elide/ui: every previously untested component now has a behavior-focused jsdom suite. Coverage: 48% → 96.75% statements / 98.37% lines; 74 → 226 tests (34 files), all green. Also fixes a blind spot: the coverageincludeonly countedsrc/components, sosrc/i18nandsrc/libwere invisible in reports — they're counted (and tested) now.All tests follow the existing conventions (RTL role/name queries, userEvent, jest-dom): open/close and keyboard flows for the Base UI overlays, aria wiring (dialogs labelled by their titles, aria-current, aria-hidden separators), callback props, and real logic (theme persistence + OS preference, i18n deep-merge,
keyed()stability, table-of-contents scroll-spy via a captured IntersectionObserver stub).jsdom gaps are stubbed per test file, never in shared setup: PointerEvent, ResizeObserver, matchMedia, scrollIntoView, and an in-memory localStorage (Node's built-in
localStorageshadows jsdom's and throws unless launched with--localstorage-file).Remaining gaps (intentional)
open, section header variants); statements are at 100%.Pre-existing issue (not addressed here)
bunx tsc --noEmitfails on main insrc/stories/CommandPalette.stories.tsx(2 × TS2322: story objects usingrenderlack the requiredargs) — shipped with #3, unrelated to this PR, left untouched to keep this tests-only. Trivial fix: addargs: { groups: [] }(or makegroupsoptional in meta args typing) to the two stories.Test plan
bun run test:coverage— 34 files / 226 tests pass; 96.75% stmts, 90.56% branch, 98.37% lineseslint srcclean🤖 Generated with Claude Code