aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/BorderedContainer.test.tsx
blob: 2d1b66379791897041c93946df4c40544a483a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * @vitest-environment jsdom
 */
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, test } from "vitest";
import BorderedContainer from "./BorderedContainer";

afterEach(() => {
	cleanup();
});

describe("BorderedContainer", () => {
	test("renders children", () => {
		render(<BorderedContainer>Hello World</BorderedContainer>);
		expect(screen.getByText("Hello World")).toBeDefined();
	});

	test("applies custom className", () => {
		render(
			<BorderedContainer className="custom-class">Content</BorderedContainer>,
		);
		const container = screen.getByText("Content").closest("div");
		expect(container?.className).toContain("custom-class");
	});

	test("has default border styling", () => {
		render(<BorderedContainer>Styled</BorderedContainer>);
		const container = screen.getByText("Styled").closest("div");
		expect(container?.className).toContain("border-2");
		expect(container?.className).toContain("border-blue-600");
		expect(container?.className).toContain("rounded-xl");
	});
});