import PrimaryPill from "$/component/pill/PrimaryPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";


const textContent = "Testing";


describe("Renders", () => {
	it("Renders with defaults", () => {
		render(<PrimaryPill>{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
		expect(pillDiv).toHaveClass("rounded-full");
	});
});

describe("Rounding", () => {
	it("Renders with no rounding", () => {
		render(<PrimaryPill rounding="none">{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
	});
	it("Renders with small rounding", () => {
		render(<PrimaryPill rounding="sm">{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
		expect(pillDiv).toHaveClass("rounded-sm");
	});
	it("Renders with medium rounding", () => {
		render(<PrimaryPill rounding="md">{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
		expect(pillDiv).toHaveClass("rounded");
	});
	it("Renders with large rounding", () => {
		render(<PrimaryPill rounding="lg">{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
		expect(pillDiv).toHaveClass("rounded-lg");
	});
	it("Renders with full rounding", () => {
		render(<PrimaryPill rounding="full">{textContent}</PrimaryPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-primary-pill");
		expect(pillDiv).toBeInTheDocument();
		expect(pillDiv).toHaveTextContent(textContent);
		//Check for the default classes
		expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
		expect(pillDiv).toHaveClass("bg-primary", "text-white");
		expect(pillDiv).toHaveClass("rounded-full");
	});
});
