"use strict";

var React = _interopRequireWildcard(require("react"));

var _enzyme = require("enzyme");

var _popover = require("../../popover");

var _index = require("../index");

var _defaultProps = _interopRequireDefault(require("../default-props"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

describe('Tooltip', function () {
  test('basic render', function () {
    var props = {
      accessibilityType: _index.ACCESSIBILITY_TYPE.none,
      content: jest.fn(),
      id: 'mock-id',
      isOpen: true,
      onBlur: jest.fn(),
      onClick: jest.fn(),
      onEsc: jest.fn(),
      onFocus: jest.fn(),
      onMouseEnter: jest.fn(),
      onMouseEnterDelay: 100,
      onMouseLeave: jest.fn(),
      onMouseLeaveDelay: 200,
      overrides: {
        Body: {
          component: function CustomBody(props) {
            // eslint-disable-next-line react/prop-types
            return React.createElement("div", null, props.children);
          },
          style: {
            width: '300px'
          }
        }
      },
      placement: _index.PLACEMENT.topLeft,
      showArrow: true,
      triggerType: _index.TRIGGER_TYPE.hover
    };
    var button = React.createElement("button", {
      type: "button"
    }, "Hover me");
    var component = (0, _enzyme.shallow)(React.createElement(_index.Tooltip, props, button));
    expect(component.type()).toBe(_popover.Popover);
    expect(component.props()).toEqual(_objectSpread({}, _defaultProps.default, props, {
      children: button,
      overrides: {
        Arrow: {
          component: _index.StyledArrow
        },
        Body: {
          component: props.overrides.Body.component,
          style: {
            width: '300px'
          }
        },
        Inner: {
          component: _index.StyledInner
        }
      }
    }));
  });
});