Skip to content

feat: Add component tests for components/ui/select.tsx - #706

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Jayydy:tests
Aug 29, 2026
Merged

feat: Add component tests for components/ui/select.tsx#706
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Jayydy:tests

Conversation

@Jayydy

@Jayydy Jayydy commented Aug 29, 2026

Copy link
Copy Markdown

Closes #651

The implementation ha been completed. Here's what the test file covers and why each choice was made:

Placeholder (3 tests)

  • Asserts the placeholder text renders when no value is set
  • Checks data-placeholder is present on the trigger — this is the attribute
    base-ui sets and what the CSS data-placeholder:text-muted-foreground rule
    targets, so testing it verifies the contract the component's styling depends
  • Confirms both the attribute and the text are absent once defaultValue is
    provided

Value selection (3 tests)

  • Uses userEvent.setup() + click to open the popup (portalled into
    document.body) then selects an item via within(listbox)
  • Asserts onValueChange is called with the correct string value
  • Asserts data-placeholder is removed and the trigger text updates after a
    controlled rerender — this mirrors how the component is used in forms
    throughout the app

Disabled state (4 tests)

  • Checks the native disabled attribute (makes toBeDisabled() true)
  • Checks data-disabled — the attribute that drives disabled:cursor-not-allowed
    disabled:opacity-50 in the trigger's className
  • Verifies clicking a disabled trigger doesn't open the popup (no listbox role
    appears)
  • Verifies onValueChange is never called when disabled

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Jayydy 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

@Austinaminu2
Austinaminu2 merged commit 44bebe1 into FlowwStar:main Aug 29, 2026
0 of 6 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

Development

Successfully merging this pull request may close these issues.

Add component tests for components/ui/select.tsx

3 participants