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


const textContent = "Testing";


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

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

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

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

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

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

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

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