"use strict";

var _react = _interopRequireDefault(require("react"));
var _testUtilities = require("testUtilities");
var _typography = require("../../typography");
var _index = _interopRequireDefault(require("./index"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
it("renders", function () {
  var _renderWithProviders = (0, _testUtilities.renderWithProviders)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
      content: "tooltip content"
    }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target"))),
    queryByText = _renderWithProviders.queryByText;
  expect(queryByText("tooltip target")).toBeVisible();
  expect(queryByText("tooltip content")).not.toBeInTheDocument();
});
it("hovers", function () {
  var _renderWithProviders2 = (0, _testUtilities.renderWithProviders)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
      content: "tooltip content"
    }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target"))),
    queryByText = _renderWithProviders2.queryByText;
  _testUtilities.fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByText("tooltip content")).toBeInTheDocument();
});
it("renders plain", function () {
  var _renderWithProviders3 = (0, _testUtilities.renderWithProviders)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
      plain: true,
      content: "tooltip content"
    }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target"))),
    queryByTestId = _renderWithProviders3.queryByTestId,
    queryByText = _renderWithProviders3.queryByText;
  _testUtilities.fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByTestId("drop")).toHaveTextContent("tooltip content");
});
it("renders content from function", function () {
  var _renderWithProviders4 = (0, _testUtilities.renderWithProviders)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
      content: function content() {
        return "tooltip content";
      }
    }, function (props) {
      return /*#__PURE__*/_react["default"].createElement(_typography.Text, props, "tooltip target");
    })),
    queryByText = _renderWithProviders4.queryByText;
  _testUtilities.fireEvent.mouseOver(queryByText("tooltip target"));
  expect(queryByText("tooltip target")).toBeVisible();
  expect(queryByText("tooltip content")).toBeInTheDocument();
});
it("align", function () {
  var _renderWithProviders5 = (0, _testUtilities.renderWithProviders)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
      content: "tooltip content"
    }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target"))),
    getByTestId = _renderWithProviders5.getByTestId,
    queryByText = _renderWithProviders5.queryByText,
    rerender = _renderWithProviders5.rerender;
  _testUtilities.fireEvent.mouseOver(queryByText("tooltip target"));
  expect(getByTestId("drop-arrow")).not.toHaveStyleRule("transform");
  rerender( /*#__PURE__*/_react["default"].createElement(_index["default"], {
    align: "right",
    content: "tooltip content"
  }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(90deg)");
  rerender( /*#__PURE__*/_react["default"].createElement(_index["default"], {
    align: "bottom",
    content: "tooltip content"
  }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(180deg)");
  rerender( /*#__PURE__*/_react["default"].createElement(_index["default"], {
    align: "left",
    content: "tooltip content"
  }, /*#__PURE__*/_react["default"].createElement(_typography.Text, null, "tooltip target")));
  expect(getByTestId("drop-arrow")).toHaveStyleRule("transform", "rotate(270deg)");
});