"use strict";

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

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

var _enzyme = require("enzyme");

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

describe('Tabs', function () {
  it('displays a set of tabbed content', function () {
    var node = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
      label: "Gators"
    }, "See ya later, alligator!"), /*#__PURE__*/_react["default"].createElement("div", {
      label: "Crocs"
    }, "After a while, crocodile!"))));
    expect(node.html()).toBe('<div class="Tabs "><ol class="Tabs-list "><li class="Tabs-listItem Tabs-listItem_active">Gators</li><li class="Tabs-listItem">Crocs</li></ol>See ya later, alligator!</div>');
  });
  it('should change the active tab when clicked', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
      label: "Gators"
    }, "See ya later, alligator!"), /*#__PURE__*/_react["default"].createElement("div", {
      label: "Crocs"
    }, "After a while, crocodile!")));
    node.find('li.Tabs-listItem').at(1).simulate('click');
    expect(node.find('li.Tabs-listItem').at(1).hasClass('Tabs-listItem_active')).toBe(true);
    expect(node.state().activeTab).toBe('Crocs');
    node.find('li.Tabs-listItem').at(0).simulate('click');
    expect(node.find('li.Tabs-listItem').at(0).hasClass('Tabs-listItem_active')).toBe(true);
    expect(node.find('li.Tabs-listItem').at(1).hasClass('Tabs-listItem_active')).toBe(false);
    expect(node.state().activeTab).toBe('Gators');
  });
  it('should fire an onClick event when the tab is changed', function () {
    var onClick = jest.fn();
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      onClick: onClick
    }, /*#__PURE__*/_react["default"].createElement("div", {
      label: "Gators"
    }, "See ya later, alligator!"), /*#__PURE__*/_react["default"].createElement("div", {
      label: "Crocs"
    }, "After a while, crocodile!")));
    node.find('li.Tabs-listItem').at(1).simulate('click');
    expect(onClick).toHaveBeenCalled();
    expect(onClick.mock.calls[0][0]).toBe('Crocs');
  });
});