From ffb214047c1add9404972808e0372346bb380ee1 Mon Sep 17 00:00:00 2001 From: chloeilabs Date: Sat, 18 Apr 2026 22:57:38 -0500 Subject: [PATCH] Align auth password toggle with Chloei --- .../auth/__tests__/password-input.test.tsx | 18 ++++++++++++++++++ src/components/auth/password-input.tsx | 15 ++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 src/components/auth/__tests__/password-input.test.tsx diff --git a/src/components/auth/__tests__/password-input.test.tsx b/src/components/auth/__tests__/password-input.test.tsx new file mode 100644 index 0000000..f6403c0 --- /dev/null +++ b/src/components/auth/__tests__/password-input.test.tsx @@ -0,0 +1,18 @@ +import { renderToStaticMarkup } from "react-dom/server" +import { describe, expect, it, vi } from "vitest" + +import { PasswordInput } from "../password-input" + +describe("PasswordInput", () => { + it("renders the auth toggle without finance button metadata", () => { + const markup = renderToStaticMarkup( + + ) + + expect(markup).toContain('aria-label="Show password"') + expect(markup).toContain('type="button"') + expect(markup).not.toContain('data-variant="ghost"') + expect(markup).not.toContain('data-size="sm"') + expect(markup).not.toContain("active:not-aria-[haspopup]:translate-y-px") + }) +}) diff --git a/src/components/auth/password-input.tsx b/src/components/auth/password-input.tsx index a968042..181806a 100644 --- a/src/components/auth/password-input.tsx +++ b/src/components/auth/password-input.tsx @@ -2,7 +2,6 @@ import { type ComponentProps, useState } from "react" -import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { cn } from "@/lib/utils" @@ -18,6 +17,7 @@ export function PasswordInput({ ...props }: PasswordInputProps) { const [isVisible, setIsVisible] = useState(false) + const toggleLabel = `${isVisible ? "Hide" : "Show"} ${revealLabel}` return (
@@ -28,21 +28,22 @@ export function PasswordInput({ type={isVisible ? "text" : "password"} className={cn("pr-14", className)} /> - +
) }