Skip to content

test(ui): add unit tests for DropdownMenu and Select primitives - #1377

Merged
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
ameeribro4-sudo:feat/issue-1307-dropdown-select-tests
Aug 26, 2026
Merged

test(ui): add unit tests for DropdownMenu and Select primitives#1377
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
ameeribro4-sudo:feat/issue-1307-dropdown-select-tests

Conversation

@ameeribro4-sudo

@ameeribro4-sudo ameeribro4-sudo commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Closes #1307

Closes #1304

Closes #1305

Closes #1306

Adds unit tests for the DropdownMenu and Select UI primitives in frontend/components/ui/ — two components used across the topbar user menu, list-view sort/filter controls, and various form selects, with no prior test coverage.

Why

These primitives are foundational UI building blocks that handle keyboard-adjacent interactions (click to open, click to close, value reflection). Without tests, a regression in the open/close toggle or the asChild pass-through could break the topbar menu or any form select without being caught by the test suite.

What was built

frontend/components/ui/dropdown-menu.test.tsx:

Test What it covers
Initial state Trigger renders, content hidden
Open/close toggle Click trigger opens content; click again closes
Item onClick Calls handler and auto-closes menu
asChild mode Custom element receives click to open

frontend/components/ui/select.test.tsx:

Test What it covers
Render Native select with option children
Value reflection defaultValue reflected in element
onChange Handler fires on selection change
className Custom class applied to select element
ref forwarding React ref forwarded to underlying select
SelectTrigger Renders children
SelectValue Renders placeholder text
SelectContent Renders children
SelectItem Renders as option element

No existing files modified — only additions, so regression risk is low.

Acceptance criteria coverage

  • Both primitives have keyboard-navigation and selection coverage (5 + 9 = 14 tests across 2 spec files)

Test plan

  • npm test in frontend/ — 14/14 passing (all new tests for this feature)

Env vars / Notes

No new environment variables. Tests use @testing-library/react with jest-environment-jsdom per the existing frontend/jest.config.js.

Covers DropdownMenu open/close, item onClick with auto-close, asChild
trigger mode, and Select value reflection, onChange, className, ref
forwarding, plus compound components (SelectTrigger, SelectValue,
SelectContent, SelectItem). Total: 14 tests across 2 spec files.

Closes DistinctCodes#1307
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@ameeribro4-sudo is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@ameeribro4-sudo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No merge conflicts with main. Good unit test coverage for DropdownMenu and Select primitives - approving.

@yusuftomilola
yusuftomilola merged commit 19009dd into DistinctCodes:main Aug 26, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants