Add pill component

This commit is contained in:
2026-02-26 23:10:08 -05:00
parent 378dae159f
commit 6c67604efc
28 changed files with 1240 additions and 9 deletions

View File

@@ -0,0 +1,84 @@
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");
});
});

View File

@@ -0,0 +1,84 @@
import DarkPill from "$/component/pill/DarkPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<DarkPill>{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<DarkPill rounding="none">{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
});
it("Renders with small rounding", () => {
render(<DarkPill rounding="sm">{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
expect(pillDiv).toHaveClass("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<DarkPill rounding="md">{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
expect(pillDiv).toHaveClass("rounded");
});
it("Renders with large rounding", () => {
render(<DarkPill rounding="lg">{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
expect(pillDiv).toHaveClass("rounded-lg");
});
it("Renders with full rounding", () => {
render(<DarkPill rounding="full">{textContent}</DarkPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-dark-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-dark", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});

View File

@@ -0,0 +1,84 @@
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");
});
});

View File

@@ -0,0 +1,84 @@
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");
});
});

View File

@@ -0,0 +1,84 @@
import MoltenPill from "$/component/pill/MoltenPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<MoltenPill>{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
expect(pillDiv).toHaveClass("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<MoltenPill rounding="none">{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
});
it("Renders with small rounding", () => {
render(<MoltenPill rounding="sm">{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
expect(pillDiv).toHaveClass("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<MoltenPill rounding="md">{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
expect(pillDiv).toHaveClass("rounded");
});
it("Renders with large rounding", () => {
render(<MoltenPill rounding="lg">{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
expect(pillDiv).toHaveClass("rounded-lg");
});
it("Renders with full rounding", () => {
render(<MoltenPill rounding="full">{textContent}</MoltenPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-molten-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-molten", "text-black");
expect(pillDiv).toHaveClass("rounded-full");
});
});

View File

@@ -0,0 +1,78 @@
import Pill from "$/component/pill/Pill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<Pill>{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-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("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<Pill rounding="none">{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-pill");
expect(pillDiv).toBeInTheDocument();
expect(pillDiv).toHaveTextContent(textContent);
//Check for the default classes
expect(pillDiv).toHaveClass("px-2", "text-sm", "whitespace-nowrap");
});
it("Renders with small rounding", () => {
render(<Pill rounding="sm">{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-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("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<Pill rounding="md">{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-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("rounded");
});
it("Renders with large rounding", () => {
render(<Pill rounding="lg">{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-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("rounded-lg");
});
it("Renders with full rounding", () => {
render(<Pill rounding="full">{textContent}</Pill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-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("rounded-full");
});
});

View File

@@ -0,0 +1,84 @@
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");
});
});

View File

@@ -0,0 +1,84 @@
import SecondaryPill from "$/component/pill/SecondaryPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<SecondaryPill>{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<SecondaryPill rounding="none">{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
});
it("Renders with small rounding", () => {
render(<SecondaryPill rounding="sm">{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
expect(pillDiv).toHaveClass("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<SecondaryPill rounding="md">{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
expect(pillDiv).toHaveClass("rounded");
});
it("Renders with large rounding", () => {
render(<SecondaryPill rounding="lg">{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
expect(pillDiv).toHaveClass("rounded-lg");
});
it("Renders with full rounding", () => {
render(<SecondaryPill rounding="full">{textContent}</SecondaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-secondary-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-secondary", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});

View File

@@ -0,0 +1,84 @@
import SuccessPill from "$/component/pill/SuccessPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<SuccessPill>{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
expect(pillDiv).toHaveClass("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<SuccessPill rounding="none">{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
});
it("Renders with small rounding", () => {
render(<SuccessPill rounding="sm">{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
expect(pillDiv).toHaveClass("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<SuccessPill rounding="md">{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
expect(pillDiv).toHaveClass("rounded");
});
it("Renders with large rounding", () => {
render(<SuccessPill rounding="lg">{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
expect(pillDiv).toHaveClass("rounded-lg");
});
it("Renders with full rounding", () => {
render(<SuccessPill rounding="full">{textContent}</SuccessPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-success-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-success", "text-black");
expect(pillDiv).toHaveClass("rounded-full");
});
});

View File

@@ -0,0 +1,84 @@
import TertiaryPill from "$/component/pill/TertiaryPill";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
const textContent = "Testing";
describe("Renders", () => {
it("Renders with defaults", () => {
render(<TertiaryPill>{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});
describe("Rounding", () => {
it("Renders with no rounding", () => {
render(<TertiaryPill rounding="none">{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
});
it("Renders with small rounding", () => {
render(<TertiaryPill rounding="sm">{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
expect(pillDiv).toHaveClass("rounded-sm");
});
it("Renders with medium rounding", () => {
render(<TertiaryPill rounding="md">{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
expect(pillDiv).toHaveClass("rounded");
});
it("Renders with large rounding", () => {
render(<TertiaryPill rounding="lg">{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
expect(pillDiv).toHaveClass("rounded-lg");
});
it("Renders with full rounding", () => {
render(<TertiaryPill rounding="full">{textContent}</TertiaryPill>);
//Make sure the pill div is present
const pillDiv = screen.getByTestId("mattrixwv-tertiary-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-tertiary", "text-white");
expect(pillDiv).toHaveClass("rounded-full");
});
});

View File

@@ -0,0 +1,84 @@
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");
});
});