"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _BreadcrumbPanels = _interopRequireDefault(require("../BreadcrumbPanels"));
var _Panel = _interopRequireDefault(require("../Panel"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
describe('BreadcrumbPanels Specs', function () {
  test('should render content properly inside panel', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_BreadcrumbPanels["default"], {
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Panel["default"], {
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
          children: "Panel content"
        })
      })
    }));
    var panel = _react.screen.getByText('Panel content');
    expect(panel).toBeInTheDocument();
  });
  test('should set {autoFocus} on child to \'default-element\' when navigating to a higher index', function () {
    var DivPanel = function DivPanel(_ref) {
      var autoFocus = _ref.autoFocus,
        id = _ref.id;
      return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        "data-testid": "panel",
        id: id,
        children: autoFocus
      });
    };
    var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BreadcrumbPanels["default"], {
        index: 0,
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DivPanel, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DivPanel, {
          id: "p2"
        })]
      })),
      rerender = _render.rerender;
    rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_BreadcrumbPanels["default"], {
      index: 1,
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DivPanel, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DivPanel, {
        id: "p2"
      })]
    }));
    var expected = 'default-element';
    var actual = _react.screen.getAllByTestId('panel')[0].textContent;
    expect(actual).toBe(expected);
  });
});