"use strict";

var _react = require("@testing-library/react");
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
var _Breadcrumb = _interopRequireDefault(require("../Breadcrumb"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
describe('Breadcrumb Specs', function () {
  test('should include {index} in the payload of {onSelect}', /*#__PURE__*/_asyncToGenerator(function* () {
    var handleSelect = jest.fn();
    var user = _userEvent["default"].setup();
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Breadcrumb["default"], {
      index: 3,
      onSelect: handleSelect
    }));
    var breadcrumb = _react.screen.getByLabelText('GO TO PREVIOUS');
    yield user.click(breadcrumb);
    var expected = 3;
    var actual = handleSelect.mock.calls[0][0].index;
    expect(actual).toBe(expected);
  }));
  test('should include call both the {onClick} and {onSelect} handlers on click', /*#__PURE__*/_asyncToGenerator(function* () {
    var handleSelect = jest.fn();
    var handleClick = jest.fn();
    var user = _userEvent["default"].setup();
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Breadcrumb["default"], {
      index: 3,
      onClick: handleClick,
      onSelect: handleSelect
    }));
    var breadCrumb = _react.screen.getByLabelText('GO TO PREVIOUS');
    yield user.click(breadCrumb);
    var expected = true;
    var actual = handleSelect.mock.calls.length === 1 && handleClick.mock.calls.length === 1;
    expect(actual).toBe(expected);
  }));
});