refactor(auth): migrate form controls to tailwind
This commit is contained in:
@@ -3,6 +3,9 @@ import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { AuthBackground } from "../auth-background";
|
||||
import { AuthErrorMessage } from "../auth-error-message";
|
||||
import { AuthLegalText } from "../auth-legal-text";
|
||||
import { AuthSocialButton } from "../auth-social-button";
|
||||
import { AuthTextField } from "../auth-text-field";
|
||||
import { EmailLoginForm } from "../email-login-form";
|
||||
import { EmailRegisterForm } from "../email-register-form";
|
||||
|
||||
@@ -49,4 +52,42 @@ describe("auth Tailwind components", () => {
|
||||
expect(html).toContain("object-cover");
|
||||
expect(html).toContain("%2Fimages%2Fauth%2Fbg-login.png");
|
||||
});
|
||||
|
||||
it("renders AuthSocialButton with Tailwind button layout", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<AuthSocialButton icon={<span>G</span>}>Continue</AuthSocialButton>,
|
||||
);
|
||||
|
||||
expect(html).toContain("min-h-[var(--auth-social-button-height)]");
|
||||
expect(html).toContain("border-auth-border");
|
||||
expect(html).toContain("text-auth-text-primary");
|
||||
expect(html).toContain("Continue");
|
||||
});
|
||||
|
||||
it("renders AuthLegalText with Tailwind checkbox and links", () => {
|
||||
const html = renderToStaticMarkup(<AuthLegalText />);
|
||||
|
||||
expect(html).toContain('aria-label="Agree to terms"');
|
||||
expect(html).toContain("size-[var(--auth-legal-checkbox-size)]");
|
||||
expect(html).toContain("bg-auth-legal-check");
|
||||
expect(html).toContain("Privacy Agreement");
|
||||
expect(html).toContain("Terms of User");
|
||||
});
|
||||
|
||||
it("renders AuthTextField with Tailwind input states", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<AuthTextField
|
||||
value="bad"
|
||||
onChange={() => {}}
|
||||
label="Email"
|
||||
placeholder="Email"
|
||||
errorMessage="Invalid email"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("min-h-[var(--auth-field-height)]");
|
||||
expect(html).toContain("placeholder:text-auth-input-placeholder");
|
||||
expect(html).toContain("text-auth-text-primary");
|
||||
expect(html).toContain("Invalid email");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user