"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__ = require("../..");
function renderWithTheme(ui) {
  return (0, import_react2.render)(ui, { wrapper: import__.ThemeProvider });
}
const title = "Welcome to Yoga";
const description = "Enjoy your membership!";
const caption = "Caption Description here.";
describe("<Feedback />", () => {
  it("should render the title and description", () => {
    const { getByText } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "success", title, description })
    );
    expect(getByText(title)).toBeTruthy();
    expect(getByText(description)).toBeTruthy();
  });
  it("should render the title children", () => {
    const { getByRole } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "success", description: "Enjoy your membership!", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.Title, { as: "h1", children: title }) })
    );
    expect(getByRole("heading", { name: title })).toBeTruthy();
  });
  it("should render caption children", () => {
    const { getByText } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "success", title, description, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.Caption, { children: caption }) })
    );
    expect(getByText(caption)).toBeTruthy();
  });
  it("should render the buttons", () => {
    const { getByRole } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.Feedback, { variant: "success", title, description, children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.PrimaryButton, { children: "Ok" }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.SecondaryButton, { children: "Cancel" })
      ] })
    );
    expect(getByRole("button", { name: "Ok" })).toBeTruthy();
    expect(getByRole("button", { name: "Cancel" })).toBeTruthy();
  });
  it("should render title, description, buttons and caption", () => {
    const { getByText, getByRole } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.Feedback, { variant: "success", description: "Enjoy your membership!", children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.Caption, { children: caption }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.PrimaryButton, { children: "Ok" }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback.SecondaryButton, { children: "Cancel" })
      ] })
    );
    expect(getByText(caption)).toBeTruthy();
    expect(getByRole("button", { name: "Ok" })).toBeTruthy();
    expect(getByRole("button", { name: "Cancel" })).toBeTruthy();
  });
  it("should render correctly when not centered vertically", () => {
    const { baseElement } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import__.Feedback,
        {
          variant: "success",
          title,
          description,
          center: false
        }
      )
    );
    expect(baseElement).toMatchSnapshot();
  });
  it("should render the icon for success variant", () => {
    const { getByTestId } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "success", title, description })
    );
    expect(getByTestId("feedback-icon-success")).toMatchSnapshot();
  });
  it("should render the icon for informative variant", () => {
    const { getByTestId } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import__.Feedback,
        {
          variant: "informative",
          title,
          description
        }
      )
    );
    expect(getByTestId("feedback-icon-informative")).toMatchSnapshot();
  });
  it("should render the icon for attention variant", () => {
    const { getByTestId } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "attention", title, description })
    );
    expect(getByTestId("feedback-icon-attention")).toMatchSnapshot();
  });
  it("should render the icon for delayed variant", () => {
    const { getByTestId } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Feedback, { variant: "delayed", title, description })
    );
    expect(getByTestId("feedback-icon-delayed")).toMatchSnapshot();
  });
  it("should render multiple paragraphs when description is an array", () => {
    const multiDescription = [
      "First paragraph of the feedback description.",
      "Second paragraph providing extra context.",
      "Third paragraph with final details."
    ];
    const { getByText } = renderWithTheme(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import__.Feedback,
        {
          variant: "success",
          title,
          description: multiDescription
        }
      )
    );
    multiDescription.forEach((text) => {
      expect(getByText(text)).toBeTruthy();
    });
  });
});
