mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
36 lines
920 B
TypeScript
36 lines
920 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { Button } from "./button";
|
|
|
|
describe("Button", () => {
|
|
it("uses semibold text for primary buttons", () => {
|
|
const { rerender } = render(<Button>Primary</Button>);
|
|
|
|
expect(screen.getByRole("button", { name: "Primary" })).toHaveClass(
|
|
"font-semibold",
|
|
);
|
|
|
|
rerender(<Button variant="outline">Outline</Button>);
|
|
|
|
expect(screen.getByRole("button", { name: "Outline" })).toHaveClass(
|
|
"font-medium",
|
|
);
|
|
expect(screen.getByRole("button", { name: "Outline" })).not.toHaveClass(
|
|
"font-semibold",
|
|
);
|
|
});
|
|
|
|
it("supports extra-small link buttons", () => {
|
|
render(
|
|
<Button variant="link" size="link-xs">
|
|
Open link
|
|
</Button>,
|
|
);
|
|
|
|
expect(screen.getByRole("button", { name: "Open link" })).toHaveClass(
|
|
"text-xs",
|
|
);
|
|
});
|
|
});
|