Repository navigation
test: cover DocsNavbar command palette keyboard paths and useHoverDropdown lifecycle - #159
Merged
Merged
Conversation
…pdown lifecycle Adds 15 jsdom behavior tests for the docs navbar: Ctrl/Cmd+K toggle, ArrowUp/ArrowDown clamping and Enter navigation, 300 ms debounce, blank-query reset, /api/search error and rejection recovery, mobile button / backdrop / Escape teardown, and the useHoverDropdown hover-menu open, delayed close, re-enter cancel, trigger switch and Escape paths. DocsNavbar.tsx 62.6% -> 98.9% statements; useHoverDropdown.ts 0 -> 21/21 lines; suite total 79.9% -> 81.7% statements. Closes #158 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for hivecommons-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Test Improvement
Adds
src/__tests__/DocsNavbar.search-keyboard.test.tsx— 15 jsdom behavior tests for the docs navbar command palette and hover menus, reusing the mock setup fromDocsChrome.behavior.test.tsx:Ctrl+K/⌘Ktoggle with input focus;ArrowDown/ArrowUpselection with clamping at both ends;Enternavigates to the selected result (via a stubbedwindow.location.hrefsetter); hover-to-select on a result; arrows/Enter are no-ops with zero results./api/search?q=…call after the 300 ms debounce; a whitespace query resets results/spinner without calling the API; non-OK status and a rejectedfetchboth logSearch error:and clear results; a payload withoutresultsis treated as empty.Escapetear down query + results so a reopen shows the empty-state prompt.useHoverDropdownlifecycle (fake timers,DROPDOWN_HIDE_DELAY_MS): opens on hover, stays open atdelay − 1 ms, closes atdelay; re-entering the panel cancels the pending close; switching triggers replaces the open menu and discards the stale timer;Escapecloses a dropdown when the palette is not open.Coverage at
7d13e99→ this branch (npx vitest run --coverage, same asvitest.yml):DocsNavbar.tsxstmts / branches / funcsuseHoverDropdown.tslines80 files / 774 tests green;
eslint,tsc --noEmit, andprettier --checkclean on the new file. Includes achangelog.d/added-*.mdfragment.Closes #158
Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88