import "@testing-library/jest-dom";
import { render, screen } from "@testing-library/react";
import RadioButton from "./RadioButton";
describe("RadioButton", () => {
test("should render with the correct label", () => {
render();
expect(screen.getByText("Test Label")).toBeInTheDocument();
});
test("should have the correct name attribute", () => {
render();
expect(screen.getByRole("radio")).toHaveAttribute("name", "test");
});
test("should apply the correct className", () => {
render(
,
);
expect(screen.getByLabelText("Test Label").parentElement).toHaveClass(
"radio custom-class",
);
});
test("should call ref when provided", () => {
const ref = vi.fn();
render();
expect(ref).toHaveBeenCalled();
});
test("should have the correct default value", () => {
render(
,
);
expect(screen.getByRole("radio")).toHaveAttribute("value", "default");
});
test.todo("should be selectable");
});