import React from "react";
import { renderWithProviders, fireEvent, waitFor } from "testUtilities";
import { Text } from "../../typography";
import Tooltip from "./index";
it("renders", function () {
  var _renderWithProviders = renderWithProviders( /*#__PURE__*/React.createElement(Tooltip, {
      content: "tooltip content"
    }, /*#__PURE__*/React.createElement(Text, null, "tooltip target"))),
    queryByText = _renderWithProviders.queryByText;
  expect(queryByText("tooltip target")).toBeVisible();
  expect(queryByText("tooltip content")).not.toBeInTheDocument();
});
it("hovers", function () {
  var _renderWithProviders2 = renderWithProviders( /*#__PURE__*/React.createElement(Tooltip, {
      content: "tooltip content"
    }, /*#__PURE__*/React.createElement(Text, null, "tooltip target"))),
    queryByText = _renderWithProviders2.queryByText;
  fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByText("tooltip content")).toBeInTheDocument();
});
it("renders plain", function () {
  var _renderWithProviders3 = renderWithProviders( /*#__PURE__*/React.createElement(Tooltip, {
      plain: true,
      content: "tooltip content"
    }, /*#__PURE__*/React.createElement(Text, null, "tooltip target"))),
    queryByTestId = _renderWithProviders3.queryByTestId,
    queryByText = _renderWithProviders3.queryByText;
  fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByTestId("drop")).toHaveTextContent("tooltip content");
});
it("renders content from function", function () {
  var _renderWithProviders4 = renderWithProviders( /*#__PURE__*/React.createElement(Tooltip, {
      content: function content() {
        return "tooltip content";
      }
    }, function (props) {
      return /*#__PURE__*/React.createElement(Text, props, "tooltip target");
    })),
    queryByText = _renderWithProviders4.queryByText;
  fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByText("tooltip target")).toBeVisible();
  expect(queryByText("tooltip content")).toBeInTheDocument();
});
it("align", function () {
  var _renderWithProviders5 = renderWithProviders( /*#__PURE__*/React.createElement(Tooltip, {
      content: "tooltip content"
    }, /*#__PURE__*/React.createElement(Text, null, "tooltip target"))),
    getByTestId = _renderWithProviders5.getByTestId,
    queryByText = _renderWithProviders5.queryByText,
    rerender = _renderWithProviders5.rerender;
  fireEvent.mouseOver(queryByText("tooltip target"));
  expect(getByTestId("drop-arrow")).not.toHaveStyleRule("transform");
  rerender( /*#__PURE__*/React.createElement(Tooltip, {
    align: "right",
    content: "tooltip content"
  }, /*#__PURE__*/React.createElement(Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(90deg)");
  rerender( /*#__PURE__*/React.createElement(Tooltip, {
    align: "bottom",
    content: "tooltip content"
  }, /*#__PURE__*/React.createElement(Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(180deg)");
  rerender( /*#__PURE__*/React.createElement(Tooltip, {
    align: "left",
    content: "tooltip content"
  }, /*#__PURE__*/React.createElement(Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(270deg)");
});