"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _storybookSnapper = require("storybook-snapper");
var _SidebarSubMenuNext = _interopRequireDefault(require("../SidebarSubMenuNext"));
var _SidebarNextContext = require("../../SidebarNext/SidebarNextContext");
var _Layout = require("../../Layout");
var _SidebarItemNext = _interopRequireDefault(require("../../SidebarItemNext/SidebarItemNext"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SidebarSubMenuNext/test/SidebarSubMenuNext.visual.jsx",
  _this = void 0;
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var commonProps = {
  title: 'Sub Menu'
};
var tests = [{
  describe: 'selected',
  its: [{
    it: 'submenu itself is selected',
    context: {
      selectedKey: 'first-item',
      selectedPath: ['first-item'],
      isExpanded: function isExpanded() {
        return true;
      }
    }
  }, {
    it: 'first item in menu selected',
    context: {
      selectedKey: 'second-item',
      selectedPath: ['first-item', 'second-item'],
      isExpanded: function isExpanded() {
        return true;
      }
    }
  }]
}, {
  describe: 'selected as anchor',
  its: [{
    it: 'first item in submenu selected',
    props: {
      as: 'a',
      itemKey: 'first-item'
    },
    itemProps: {
      as: 'a'
    },
    context: {
      selectedKey: 'fourth-item',
      selectedPath: ['first-item', 'third-item', 'fourth-item'],
      isExpanded: function isExpanded() {
        return true;
      }
    }
  }]
}, {
  describe: 'prefix',
  its: [{
    it: 'all items with prefix',
    props: {
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.SmileSmall, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 61,
          columnNumber: 19
        }
      })
    },
    itemProps: {
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.SmileSmall, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 64,
          columnNumber: 19
        }
      })
    },
    context: {
      selectedKey: 'first-item',
      selectedPath: ['first-item'],
      isExpanded: function isExpanded() {
        return true;
      }
    }
  }]
}];
(0, _storybookSnapper.visualize)(_SidebarSubMenuNext["default"].displayName, function () {
  tests.forEach(function (_ref) {
    var describe = _ref.describe,
      its = _ref.its;
    (0, _storybookSnapper.story)(describe, function () {
      its.map(function (_ref2) {
        var it = _ref2.it,
          props = _ref2.props,
          itemProps = _ref2.itemProps,
          context = _ref2.context;
        return (0, _storybookSnapper.snap)(it, function () {
          var skins = ['dark', 'light', 'neutral'];
          return /*#__PURE__*/_react["default"].createElement(_Layout.Layout, {
            cols: skins.length,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 83,
              columnNumber: 13
            }
          }, skins.map(function (sidebarSkin) {
            return /*#__PURE__*/_react["default"].createElement(_SidebarNextContext.SidebarNextContext.Provider, {
              value: _objectSpread({
                skin: sidebarSkin,
                selectedKey: props && props.selectedKey,
                onSubMenuOpen: function onSubMenuOpen() {},
                onSubMenuClose: function onSubMenuClose() {},
                setSelectedParentKey: function setSelectedParentKey() {},
                level: 1
              }, context),
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 85,
                columnNumber: 17
              }
            }, /*#__PURE__*/_react["default"].createElement(_SidebarSubMenuNext["default"], (0, _extends2["default"])({}, commonProps, props, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 96,
                columnNumber: 19
              }
            }), /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              itemKey: "second-item",
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 97,
                columnNumber: 21
              }
            }), "Item 1"), /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 100,
                columnNumber: 21
              }
            }), "Item 2"), /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 101,
                columnNumber: 21
              }
            }), "Item 3"), /*#__PURE__*/_react["default"].createElement(_SidebarSubMenuNext["default"], {
              title: "Sub Menu",
              itemKey: "third-item",
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 102,
                columnNumber: 21
              }
            }, /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              itemKey: "fourth-item",
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 103,
                columnNumber: 23
              }
            }), "Item 1"), /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 106,
                columnNumber: 23
              }
            }), "Item 2"), /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, itemProps, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 107,
                columnNumber: 23
              }
            }), "Item 3"))));
          }));
        });
      });
    });
  });
});