Skip to content

test: cover DocsNavbar command palette keyboard paths and useHoverDropdown lifecycle - #159

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-docs-navbar-palette
Oct 2, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-docs-navbar-palette

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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 from DocsChrome.behavior.test.tsx:

  • Keyboard shortcuts: Ctrl+K / ⌘K toggle with input focus; ArrowDown / ArrowUp selection with clamping at both ends; Enter navigates to the selected result (via a stubbed window.location.href setter); hover-to-select on a result; arrows/Enter are no-ops with zero results.
  • Search request lifecycle: rapid typing collapses to a single /api/search?q=… call after the 300 ms debounce; a whitespace query resets results/spinner without calling the API; non-OK status and a rejected fetch both log Search error: and clear results; a payload without results is treated as empty.
  • Open/close affordances: mobile search button opens and focuses; backdrop click and Escape tear down query + results so a reopen shows the empty-state prompt.
  • useHoverDropdown lifecycle (fake timers, DROPDOWN_HIDE_DELAY_MS): opens on hover, stays open at delay − 1 ms, closes at delay; re-entering the panel cancels the pending close; switching triggers replaces the open menu and discards the stale timer; Escape closes a dropdown when the palette is not open.

Coverage at 7d13e99 → this branch (npx vitest run --coverage, same as vitest.yml):

File Before After
DocsNavbar.tsx stmts / branches / funcs 62.6% / 45.9% / 54.2% 98.9% / 84.3% / 95.8%
useHoverDropdown.ts lines 0 / 21 21 / 21
All files stmts / branches 79.9% / 74.6% 81.7% / 78.3%

80 files / 774 tests green; eslint, tsc --noEmit, and prettier --check clean on the new file. Includes a changelog.d/added-*.md fragment.

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

…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>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hivecommons-docs ready!

Name Link
🔨 Latest commit 574359b
🔍 Latest deploy log https://app.netlify.com/projects/hivecommons-docs/deploys/6abf01db7c114c0008af6a57
😎 Deploy Preview https://deploy-preview-159--hivecommons-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hivecommons-hive
hivecommons-hive Bot merged commit 10b5250 into main Oct 2, 2026
9 of 10 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-docs-navbar-palette branch October 2, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] DocsNavbar command palette keyboard/search paths and useHoverDropdown hook untested (62.6% stmts, hook 0/21 lines)

0 participants