"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

describe('Dropdown', function () {
  var node = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], null, "Hello, world."));
  it('to display a .Dropdown element.', function () {
    expect(node.hasClass('Dropdown')).toBe(true);
  });
  it('to toggle the inner .Dropdown-content child on click.', function () {
    node.find('.Dropdown-toggle').simulate('click');
    expect(node.hasClass('Dropdown_opened')).toBe(true);
  });
  it('to toggle the inner .Dropdown-content child on keydown.', function () {
    node.find('.Dropdown-toggle').simulate('keypress');
    expect(node.hasClass('Dropdown_opened')).toBe(true);
  });
  it('to toggle the inner .Dropdown-content child on focus.', function () {
    node.find('.Dropdown').simulate('focus');
    expect(node.hasClass('Dropdown_opened')).toBe(true);
  });
  it('to toggle the inner .Dropdown-content child on hover.', function () {
    node.find('.Dropdown').simulate('mouseenter');
    expect(node.hasClass('Dropdown_opened')).toBe(true);
  });
  it('should pass toggle value to callback if callback exists', function () {
    var props = {
      onToggle: jest.fn()
    };
    var n2 = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], props, "Hello, world."));
    n2.find('.Dropdown-toggle').simulate('click');
    expect(props.onToggle).toHaveBeenCalled();
  });
});