/* ! * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. */ import { render, screen } from "@testing-library/react"; import { Button, Classes as CoreClasses } from "@blueprintjs/core"; import { describe, expect, test } from "@blueprintjs/test-commons/vitest"; import { Classes } from "../../common"; import { Flex } from "./flex"; const NS = Classes.getClassNamespace(); describe("", () => { test("should render content", () => { render(Test); const flex = screen.getByText(/test/i); expect(flex).toBeInTheDocument(); }); test("should always set display flex", () => { render(Test); const flex = screen.getByText(/test/i); expect(flex).toHaveClass(`${NS}-flex`); }); test("should pass through Box props", () => { render( Test , ); const flex = screen.getByTestId("flex-test"); expect(flex).toHaveClass(`${NS}-gap-2`); expect(flex).toHaveClass(`${NS}-flex-column`); }); test("should support className", () => { render(Test); const flex = screen.getByText(/test/i); expect(flex).toHaveClass("custom-class"); expect(flex).toHaveClass(Classes.BOX); }); test("should support style prop", () => { render(Test); const flex = screen.getByText(/test/i); expect(flex).toHaveStyle({ fontWeight: 700 }); }); test("should support asChild prop", () => { render( , ); const button = screen.getByRole("button", { name: /test/i }); expect(button).toHaveClass(Classes.BOX); expect(button).toHaveClass(CoreClasses.BUTTON); expect(button).toHaveClass(`${NS}-flex`); expect(button).toHaveClass(`${NS}-gap-2`); }); test("should support all flex-related props", () => { render( Test , ); const flex = screen.getByTestId("flex-all-props"); expect(flex).toHaveClass(`${NS}-flex-row`); expect(flex).toHaveClass(`${NS}-flex-wrap`); expect(flex).toHaveClass(`${NS}-justify-center`); expect(flex).toHaveClass(`${NS}-items-center`); expect(flex).toHaveClass(`${NS}-gap-3`); }); });