"use strict";

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

var _enzyme = require("enzyme");

var _sinon = _interopRequireDefault(require("sinon"));

var _Breadcrumb = _interopRequireDefault(require("../Breadcrumb"));

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

describe('Breadcrumb', function () {
  it('should include {index} in the payload of {onSelect}', function () {
    var handleSelect = _sinon.default.spy();

    var subject = (0, _enzyme.mount)(_react.default.createElement(_Breadcrumb.default, {
      index: 3,
      onSelect: handleSelect
    }));
    subject.simulate('click', {});
    var expected = 3;
    var actual = handleSelect.firstCall.args[0].index;
    expect(actual).to.equal(expected);
  });
  it('should include call both the {onClick} and {onSelect} handlers on click', function () {
    var handleSelect = _sinon.default.spy();

    var handleClick = _sinon.default.spy();

    var subject = (0, _enzyme.mount)(_react.default.createElement(_Breadcrumb.default, {
      index: 3,
      onClick: handleClick,
      onSelect: handleSelect
    }));
    subject.simulate('click', {});
    var expected = true;
    var actual = handleSelect.calledOnce && handleClick.calledOnce;
    expect(actual).to.equal(expected);
  });
});