import { render, screen } from "@testing-library/react";
import { Divider } from ".";
const CLASS_NAME = "mobius-divider";
describe("Divider", () => {
it("should render without errors", () => {
render();
});
it("renders as a hr element by default", () => {
render();
expect(screen.getByRole("separator")).toBeInTheDocument();
});
describe("uses correct class names", () => {
it("uses mobius class", () => {
render();
expect(screen.getByRole("separator")).toHaveClass("mobius");
});
it("uses base Mobius class", () => {
render();
expect(screen.getByRole("separator")).toHaveClass(CLASS_NAME);
});
it("includes custom class name", () => {
render();
expect(screen.getByRole("separator")).toHaveClass("my-class");
expect(screen.getByRole("separator")).toHaveClass(CLASS_NAME);
});
});
describe("ARIA attributes", () => {
it("has aria-orientation='horizontal' by default", () => {
render();
expect(screen.getByRole("separator")).toHaveAttribute(
"aria-orientation",
"horizontal",
);
});
it("supports aria-orientation='vertical'", () => {
render();
expect(screen.getByRole("separator")).toHaveAttribute(
"aria-orientation",
"vertical",
);
});
});
});