"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = __toESM(require("react"));
var import_react2 = require("@testing-library/react");
var import_global = require("@gympass/yoga-tokens/src/global");
var import__ = require("../..");
var import__2 = __toESM(require("."));
describe("<Accordion />", () => {
  afterEach(import_react2.cleanup);
  describe("should correctly render", () => {
    it("the default version", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default, { title: "Default", expanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByText("Default")).toBeInTheDocument();
      expect(import_react2.screen.getByText("Default")).toHaveStyle({
        fontSize: `${import_global.fontSizes.medium}px`,
        fontWeight: import_global.fontWeights.medium
      });
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.large}px ${import_global.spacing.medium}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the default version with v3Theme", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { theme: import__.v3theme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default, { title: "Default", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByText("Default")).toBeInTheDocument();
      expect(import_react2.screen.getByText("Default")).toHaveStyle({
        fontSize: `${import_global.fontSizes.medium}px`,
        fontWeight: import_global.fontWeights.bold
      });
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.large}px ${import_global.spacing.medium}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the small version", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Small, { title: "Small", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByText("Small")).toBeInTheDocument();
      expect(import_react2.screen.getByText("Small")).toHaveStyle({
        fontSize: `${import_global.fontSizes.small}px`,
        fontWeight: import_global.fontWeights.regular
      });
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.small}px ${import_global.spacing.medium}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the default version with subtitle", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default, { title: "Default", subtitle: "default with subtitle", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByText("Default")).toBeInTheDocument();
      expect(import_react2.screen.getByText("default with subtitle")).toBeInTheDocument();
      expect(import_react2.screen.getByText("Default")).toHaveStyle({
        fontSize: `${import_global.fontSizes.medium}px`,
        fontWeight: import_global.fontWeights.medium
      });
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.large}px ${import_global.spacing.medium}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the small version with subtitle", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Small, { title: "Small", subtitle: "small with subtitle", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByText("Small")).toBeInTheDocument();
      expect(import_react2.screen.getByText("small with subtitle")).toBeInTheDocument();
      expect(import_react2.screen.getByText("Small")).toHaveStyle({
        fontSize: `${import_global.fontSizes.small}px`,
        fontWeight: import_global.fontWeights.regular
      });
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.small}px ${import_global.spacing.medium}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the default version without side padding", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default, { title: "Default", expanded: true, hasHorizontalPadding: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.large}px ${import_global.spacing.zero}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
    it("the small version without side padding", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Small, { title: "Small", hasHorizontalPadding: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) }) }) })
      );
      expect(import_react2.screen.getByRole("button")).toHaveStyle({
        padding: `${import_global.spacing.small}px ${import_global.spacing.zero}px`
      });
      expect(container.firstChild).toMatchSnapshot();
    });
  });
  it("should render the accordion summary", () => {
    (0, import_react2.render)(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__2.default, { title: "Title", subtitle: "Subtitle", children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Summary, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Summary" }) }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }) })
      ] }) })
    );
    expect(import_react2.screen.getByText("Summary")).toBeInTheDocument();
    expect(import_react2.screen.queryByText("Title")).not.toBeInTheDocument();
    expect(import_react2.screen.queryByText("Subtitle")).not.toBeInTheDocument();
  });
  it("should have className when passed as props", () => {
    (0, import_react2.render)(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__2.default, { title: "Title", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
        import__2.default.Content,
        {
          className: "className-as-props",
          "data-testid": "accordion-content",
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Text, { children: "Content" }),
            /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Button, { small: true, inverted: true, children: "Small button" })
          ]
        }
      ) }) })
    );
    expect(import_react2.screen.getByTestId("accordion-content")).toHaveClass(
      "className-as-props"
    );
  });
});
