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


const textContent = "Testing";


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

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

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

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

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

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

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

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