From 66e2b5622109b5fad80828863a2648838209aa84 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Fri, 5 Jun 2026 17:06:36 +0530 Subject: [PATCH] feat(renderer): add shadcn input primitive --- src/renderer/components/ui/input.tsx | 25 +++++++++++++++++++++++++ tests/component/ui/input.test.tsx | 14 ++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/renderer/components/ui/input.tsx create mode 100644 tests/component/ui/input.test.tsx diff --git a/src/renderer/components/ui/input.tsx b/src/renderer/components/ui/input.tsx new file mode 100644 index 0000000..e66133c --- /dev/null +++ b/src/renderer/components/ui/input.tsx @@ -0,0 +1,25 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => { + return ( + + ) + } +) +Input.displayName = "Input" + +export { Input } \ No newline at end of file diff --git a/tests/component/ui/input.test.tsx b/tests/component/ui/input.test.tsx new file mode 100644 index 0000000..992c252 --- /dev/null +++ b/tests/component/ui/input.test.tsx @@ -0,0 +1,14 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { Input } from '@/components/ui/input'; + +describe('Input', () => { + it('renders and accepts typing', async () => { + const onChange = vi.fn(); + render(); + const input = screen.getByLabelText(/name/i); + await userEvent.type(input, 'a'); + expect(onChange).toHaveBeenCalled(); + }); +}); \ No newline at end of file