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


const textContent = "Testing";


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

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
		expect(pillDiv).toHaveClass("rounded-full");
	});
});

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

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
	});
	it("Renders with small rounding", () => {
		render(<InfoPill rounding="sm">{textContent}</InfoPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
		expect(pillDiv).toHaveClass("rounded-sm");
	});
	it("Renders with medium rounding", () => {
		render(<InfoPill rounding="md">{textContent}</InfoPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
		expect(pillDiv).toHaveClass("rounded");
	});
	it("Renders with large rounding", () => {
		render(<InfoPill rounding="lg">{textContent}</InfoPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
		expect(pillDiv).toHaveClass("rounded-lg");
	});
	it("Renders with full rounding", () => {
		render(<InfoPill rounding="full">{textContent}</InfoPill>);

		//Make sure the pill div is present
		const pillDiv = screen.getByTestId("mattrixwv-info-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-info", "text-black");
		expect(pillDiv).toHaveClass("rounded-full");
	});
});
