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


const textContent = "Testing";


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

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

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

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

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

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

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

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