import { jsx } from "react/jsx-runtime";
import React from "react";
import { render, fireEvent } from "@testing-library/react";
import ThemeProvider from "../../Theme";
import Slider from "./Slider";
describe("<Slider />", () => {
  describe("Snapshots", () => {
    describe("With one marker", () => {
      it("should match snapshot with default Slider", () => {
        const { container } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, {}) })
        );
        expect(container).toMatchSnapshot();
      });
      it("should match snapshot with Slider with labels", () => {
        const { container } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, { minLabel: 0, maxLabel: 10 }) })
        );
        expect(container).toMatchSnapshot();
      });
      it("should match snapshot with Slider snapped", () => {
        const { container } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, { snapped: true }) })
        );
        expect(container).toMatchSnapshot();
      });
    });
    describe("With two markers", () => {
      it("should match snapshot", () => {
        const { container } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, { values: [3, 7] }) })
        );
        expect(container).toMatchSnapshot();
      });
      it("should match snapshot with Slider snapped", () => {
        const { container } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, { values: [3, 7], snapped: true }) })
        );
        expect(container).toMatchSnapshot();
      });
    });
  });
  describe("Labels", () => {
    it("should render labels", () => {
      const { getByText } = render(
        /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Slider, { maxLabel: "max", minLabel: "min" }) })
      );
      expect(getByText("max").textContent).toBe("max");
      expect(getByText("min").textContent).toBe("min");
    });
  });
  describe("Tooltip", () => {
    it("should render tooltips", () => {
      const { container, getByRole, getByText } = render(
        /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(
          Slider,
          {
            values: [0],
            tooltip: [
              {
                ribbon: "ribbon",
                title: "title",
                description: "description",
                visible: true
              }
            ]
          }
        ) })
      );
      fireEvent.mouseDown(getByRole("slider"));
      expect(getByText("ribbon")).toBeTruthy();
      expect(getByText("title")).toBeTruthy();
      expect(getByText("description")).toBeTruthy();
      expect(container).toMatchSnapshot();
    });
  });
});
