Files
co-lite/solvway-admin-portal/app/components/registration/RegistrationForm.look.test.tsx
T

33 lines
1.5 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { RegistrationForm } from "./RegistrationForm";
const info = {
eventName: "Expo 2026", startDate: "2026-12-01", endDate: "2026-12-02", location: "KLCC", companyName: "INS",
notice: { id: 1, textEn: "English text", textMs: "Teks Melayu" }, interests: [],
};
const props = { info, submit: async () => undefined, onDone: () => {}, onInactive: () => {} };
const wrap = (ui: React.ReactElement) => render(ui);
describe("RegistrationForm look", () => {
it("renders no heading of its own: the visitor card carries the event header", () => {
wrap(<RegistrationForm {...props} />);
expect(screen.queryByRole("heading", { level: 1 })).toBeNull();
});
it("links a contact hint to the mobile field", () => {
wrap(<RegistrationForm {...props} />);
const hint = screen.getByText("Mobile or email is required");
expect(screen.getByLabelText("Mobile number").getAttribute("aria-describedby")).toBe(hint.id);
});
it("shows the notice as fine print in both languages", () => {
wrap(<RegistrationForm {...props} />);
expect(screen.getByText("English text").parentElement?.className).toContain("text-muted-foreground");
expect(screen.getByText("Teks Melayu")).toBeTruthy();
});
it("sets the consent sentences in regular weight", () => {
wrap(<RegistrationForm {...props} />);
expect(screen.getByText(/I agree to INS/).closest("span[class*=space-y]")).toHaveClass("font-normal");
});
});