diff --git a/library/tests/ui/basic-components/box.test.tsx b/library/tests/ui/basic-components/box.test.tsx
index 193e954..310fad5 100644
--- a/library/tests/ui/basic-components/box.test.tsx
+++ b/library/tests/ui/basic-components/box.test.tsx
@@ -8,4 +8,169 @@ describe("Box component", () => {
render(Test Box);
expect(screen.getByText("Test Box")).toBeInTheDocument();
});
+
+ it("renders custom children content", () => {
+ render(
+
+ Custom child content
+ ,
+ );
+ expect(screen.getByTestId("custom-child")).toBeInTheDocument();
+ expect(screen.getByText("Custom child content")).toBeInTheDocument();
+ });
+
+ it("renders nothing when hidden is true", () => {
+ render(Should not render);
+ expect(screen.queryByText("Should not render")).not.toBeInTheDocument();
+ });
+
+ it("renders empty when no children are provided", () => {
+ const { container } = render();
+ expect(container.firstChild).toBeEmptyDOMElement();
+ });
+
+ it("applies default padding of 16px", () => {
+ render(Padded content);
+ expect(screen.getByText("Padded content")).toHaveStyle({
+ padding: "16px",
+ });
+ });
+
+ it("applies a custom padding value", () => {
+ render(Padded content);
+ expect(screen.getByText("Padded content")).toHaveStyle({
+ padding: "32px",
+ });
+ });
+
+ it("supports a padding of 0", () => {
+ render(No padding);
+ expect(screen.getByText("No padding")).toHaveStyle({ padding: "0px" });
+ });
+
+ it("supports an extreme padding value", () => {
+ render(Huge padding);
+ expect(screen.getByText("Huge padding")).toHaveStyle({
+ padding: "1000px",
+ });
+ });
+
+ it("shows all borders by default", () => {
+ render(Bordered);
+ const box = screen.getByText("Bordered");
+ expect(box).not.toHaveStyle({ borderTop: "none" });
+ expect(box).not.toHaveStyle({ borderRight: "none" });
+ expect(box).not.toHaveStyle({ borderBottom: "none" });
+ expect(box).not.toHaveStyle({ borderLeft: "none" });
+ });
+
+ it("hides the top border when borderTop is false", () => {
+ render(No top border);
+ expect(screen.getByText("No top border")).toHaveStyle({
+ borderTop: "none",
+ });
+ });
+
+ it("hides the right border when borderRight is false", () => {
+ render(No right border);
+ expect(screen.getByText("No right border")).toHaveStyle({
+ borderRight: "none",
+ });
+ });
+
+ it("hides the bottom border when borderBottom is false", () => {
+ render(No bottom border);
+ expect(screen.getByText("No bottom border")).toHaveStyle({
+ borderBottom: "none",
+ });
+ });
+
+ it("hides the left border when borderLeft is false", () => {
+ render(No left border);
+ expect(screen.getByText("No left border")).toHaveStyle({
+ borderLeft: "none",
+ });
+ });
+
+ it("hides all borders when all border props are false", () => {
+ render(
+
+ No borders
+ ,
+ );
+ const box = screen.getByText("No borders");
+ expect(box).toHaveStyle({
+ borderTop: "none",
+ borderRight: "none",
+ borderBottom: "none",
+ borderLeft: "none",
+ });
+ });
+
+ it("applies a border radius by default", () => {
+ render(Rounded);
+ const box = screen.getByText("Rounded");
+ expect(box.style.borderRadius).not.toBe("");
+ });
+
+ it("applies box-sizing: border-box by default", () => {
+ render(Sized);
+ expect(screen.getByText("Sized")).toHaveStyle({ boxSizing: "border-box" });
+ });
+
+ it("removes default styling when removeDefaultStyle is true", () => {
+ render(No default style);
+ const box = screen.getByText("No default style");
+ expect(box).not.toHaveStyle({ padding: "16px" });
+ expect(box.style.borderRadius).toBe("");
+ });
+
+ it("applies the no-print class when noPrint is true", () => {
+ render(No print content);
+ expect(screen.getByText("No print content")).toHaveClass("no-print");
+ });
+
+ it("does not apply a class name by default", () => {
+ render(Default class);
+ expect(screen.getByText("Default class")).not.toHaveClass("no-print");
+ });
+
+ it("merges a custom style prop with the computed styles", () => {
+ render(Styled content);
+ expect(screen.getByText("Styled content")).toHaveStyle({
+ marginTop: "20px",
+ padding: "16px",
+ });
+ });
+
+ it("lets a custom style prop override computed styles", () => {
+ render(Overridden padding);
+ expect(screen.getByText("Overridden padding")).toHaveStyle({
+ padding: "5px",
+ });
+ });
+
+ it("renders consistently for darkMode prop variations", () => {
+ const { rerender } = render(Light mode);
+ expect(screen.getByText("Light mode")).toBeInTheDocument();
+
+ rerender(Dark mode);
+ expect(screen.getByText("Dark mode")).toBeInTheDocument();
+ });
+
+ it("renders long/large children content without crashing", () => {
+ const longText = "A".repeat(5000);
+ render({longText});
+ expect(screen.getByText(longText)).toBeInTheDocument();
+ });
+
+ it("matches snapshot for default rendering", () => {
+ const { asFragment } = render(Snapshot content);
+ expect(asFragment()).toMatchSnapshot();
+ });
});