"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _react = _interopRequireDefault(require("react"));
var _SidebarHeaderNext = _interopRequireDefault(require("../SidebarHeaderNext"));
var _SidebarNext = _interopRequireDefault(require("../../SidebarNext"));
var _SidebarHeaderNextPrivateUni = require("./SidebarHeaderNext.private.uni.driver");
var _unit = require("../../utils/test-utils/unit");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SidebarHeaderNext/test/SidebarHeaderNext.spec.jsx",
  _this = void 0;
describe('SidebarHeaderNext', function () {
  var render = (0, _unit.createRendererWithUniDriver)(_SidebarHeaderNextPrivateUni.sidebarHeaderNextPrivateDriverFactory);
  afterEach(function () {
    (0, _unit.cleanup)();
  });
  it('should render', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
    var _render, driver;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          _render = render(/*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
            title: "Title",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 21,
              columnNumber: 31
            }
          })), driver = _render.driver;
          _context.t0 = expect;
          _context.next = 4;
          return driver.exists();
        case 4:
          _context.t1 = _context.sent;
          (0, _context.t0)(_context.t1).toBe(true);
        case 6:
        case "end":
          return _context.stop();
      }
    }, _callee);
  })));
  it('should render the `title` prop', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
    var _render2, driver;
    return _regenerator["default"].wrap(function _callee2$(_context2) {
      while (1) switch (_context2.prev = _context2.next) {
        case 0:
          _render2 = render(/*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
            title: "Title",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 27,
              columnNumber: 31
            }
          })), driver = _render2.driver;
          _context2.t0 = expect;
          _context2.next = 4;
          return driver.getTitle();
        case 4:
          _context2.t1 = _context2.sent;
          (0, _context2.t0)(_context2.t1).toBe('Title');
        case 6:
        case "end":
          return _context2.stop();
      }
    }, _callee2);
  })));
  it('should render the `subtitle` prop', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
    var _render3, driver;
    return _regenerator["default"].wrap(function _callee3$(_context3) {
      while (1) switch (_context3.prev = _context3.next) {
        case 0:
          _render3 = render(/*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
            title: "Title",
            subtitle: "Subtitle",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 34,
              columnNumber: 7
            }
          })), driver = _render3.driver;
          _context3.t0 = expect;
          _context3.next = 4;
          return driver.getSubtitle();
        case 4:
          _context3.t1 = _context3.sent;
          (0, _context3.t0)(_context3.t1).toBe('Subtitle');
        case 6:
        case "end":
          return _context3.stop();
      }
    }, _callee3);
  })));
  it('should render given `children`', function () {
    var _render4 = render(/*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
        title: "Title",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 42,
          columnNumber: 7
        }
      }, /*#__PURE__*/_react["default"].createElement("span", {
        "data-hook": "custom-header-child",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 43,
          columnNumber: 9
        }
      }, "Children"))),
      container = _render4.container;
    expect(container.querySelector(["[data-hook='custom-header-child']"]).outerHTML).toBe("<span data-hook=\"custom-header-child\">Children</span>");
  });
  it('should render with the given `className`', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
    var _render5, driver;
    return _regenerator["default"].wrap(function _callee4$(_context4) {
      while (1) switch (_context4.prev = _context4.next) {
        case 0:
          _render5 = render(/*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
            className: "custom-class",
            title: "Title",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 54,
              columnNumber: 7
            }
          }, "Content")), driver = _render5.driver;
          _context4.t0 = expect;
          _context4.next = 4;
          return driver.element();
        case 4:
          _context4.t1 = _context4.sent.className.split(' ');
          (0, _context4.t0)(_context4.t1).toContain('custom-class');
        case 6:
        case "end":
          return _context4.stop();
      }
    }, _callee4);
  })));
  describe('skin', function () {
    it.each(['light', 'dark'])('should render with %s skin inside SidebarNext', /*#__PURE__*/function () {
      var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(skin) {
        var _render6, driver;
        return _regenerator["default"].wrap(function _callee5$(_context5) {
          while (1) switch (_context5.prev = _context5.next) {
            case 0:
              _render6 = render(/*#__PURE__*/_react["default"].createElement(_SidebarNext["default"], {
                skin: skin,
                header: /*#__PURE__*/_react["default"].createElement(_SidebarHeaderNext["default"], {
                  dataHook: "tested-header",
                  title: "header title",
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 72,
                    columnNumber: 15
                  }
                }, /*#__PURE__*/_react["default"].createElement("span", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 73,
                    columnNumber: 17
                  }
                }, "header content")),
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 69,
                  columnNumber: 11
                }
              }), {
                dataHook: 'tested-header'
              }), driver = _render6.driver;
              _context5.t0 = expect;
              _context5.next = 4;
              return driver.getSkin();
            case 4:
              _context5.t1 = _context5.sent;
              (0, _context5.t0)(_context5.t1).toEqual(skin);
            case 6:
            case "end":
              return _context5.stop();
          }
        }, _callee5);
      }));
      return function (_x) {
        return _ref5.apply(this, arguments);
      };
    }());
  });
});