Skip to content

test: added test files and cases for components/ui 4 test files (hover-card, input-otp, input, label)

ashritha kunjeti requested to merge test/ui into test_cases

Description:

hover-card.test.tsx

Added unit tests for the HoverCard component and its subcomponents (HoverCardTrigger, HoverCardContent) covering trigger rendering, hover interaction, controlled open state, custom class support, prop handling (align, sideOffset), and ref forwarding. Also included required test environment mocks for ResizeObserver, PointerEvent, and pointer capture methods to ensure stable execution in jsdom with Radix UI components.

input-otp.test.tsx

Added unit tests for the InputOTP component and its subcomponents (InputOTPGroup, InputOTPSlot, InputOTPSeparator) covering rendering, custom class support, OTP input interaction, ref forwarding, and required test environment mocks for stable execution.

label.test.tsx

Added unit tests for the Label component covering rendering, default variant classes, custom class name merging, forwarding of additional props, and proper ref forwarding to the native label element.

input.test.tsx

Added unit tests for the Input component covering rendering, type prop handling, custom class name merging, forwarding of native input props, ref forwarding, and user typing interaction.

Type of Change:

  • Bug Fix
  • Feature Development
  • Documentation

Testing:

  • Tested on desktop
  • Tested on mobile
  • Tested in different browsers

Screenshots (if applicable): image

Checklist:

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • TypeScript types are correct

*Closes #273 (closed)

Edited by ashritha kunjeti

Merge request reports

Loading