"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TestIcon = void 0;
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 _constants = require("../../SidebarNext/constants");
var _SidebarNextContext = require("../../SidebarNext/SidebarNextContext");
var _SidebarItemNext = _interopRequireDefault(require("../SidebarItemNext"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _Box = _interopRequireDefault(require("../../Box"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SidebarItemNext/test/SidebarItemNext.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 = {
  // use for repeated props across the tests (e.g. {buttonText: 'example'})
};
var TestIcon = exports.TestIcon = function TestIcon() {
  return /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
    size: 18,
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 13,
      columnNumber: 31
    }
  });
};
var tests = [{
  describe: 'Legacy sanity',
  its: [{
    it: 'Sidebar item selected',
    props: {
      selectedKey: 'first-item',
      itemKey: 'first-item'
    },
    context: {
      level: 1,
      legacy: true,
      selectedPath: ['first-item']
    }
  }, {
    it: 'Sidebar item not selected',
    props: {
      itemKey: 'first-item'
    },
    context: {
      level: 1,
      legacy: true
    }
  }, {
    it: 'Sidebar item disabled',
    props: {
      itemKey: 'first-item',
      disabled: true
    },
    context: {
      level: 1,
      legacy: true
    }
  }, {
    it: 'Sidebar item with suffix',
    props: {
      itemKey: 'first-item',
      suffix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 56,
          columnNumber: 19
        }
      })
    },
    context: {
      legacy: true
    }
  }, {
    it: 'Sidebar item with prefix',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 66,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1,
      legacy: true
    }
  }, {
    it: 'Sidebar item in context',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 77,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1,
      parent: 'inContextMenu'
    }
  }, {
    it: 'Sidebar item in 2nd level',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 88,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 2
    }
  }, {
    it: 'Sidebar item in 1st level with prefix',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 98,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1,
      legacy: true
    }
  }]
}, {
  describe: 'depth',
  its: [{
    it: 'first',
    props: {
      itemKey: 'first-item'
    },
    context: {
      level: 1
    }
  }, {
    it: 'first with prefix',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(TestIcon, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 123,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1
    }
  }, {
    it: 'second',
    props: {
      itemKey: 'first-item'
    },
    context: {
      level: 2
    }
  }, {
    it: 'second with prefix',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(TestIcon, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 142,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 2
    }
  }, {
    it: 'third',
    props: {
      itemKey: 'first-item'
    },
    context: {
      level: 3
    }
  }, {
    it: 'third with prefix',
    props: {
      itemKey: 'first-item',
      prefix: /*#__PURE__*/_react["default"].createElement(TestIcon, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 161,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 3
    }
  }]
}, {
  describe: 'in context menu',
  its: [{
    it: 'first',
    props: {
      itemKey: 'first-item'
    },
    context: {
      level: 1,
      parent: 'inContextMenu'
    }
  }]
}, {
  describe: 'disabled',
  its: [{
    it: 'disabled',
    props: {
      disabled: true,
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 191,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1,
      legacy: true
    }
  }]
}, {
  describe: 'prefix',
  its: [{
    it: 'prefix level 1',
    props: {
      prefix: /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.Smile, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 206,
          columnNumber: 19
        }
      })
    },
    context: {
      level: 1
    }
  }]
}];
(0, _storybookSnapper.visualize)(_SidebarItemNext["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,
          context = _ref2.context;
        return (0, _storybookSnapper.snap)(it, function () {
          var skins = Object.values(_constants.sidebarSkins);
          return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
            direction: "vertical",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 224,
              columnNumber: 13
            }
          }, skins.map(function (sidebarSkin) {
            return /*#__PURE__*/_react["default"].createElement(_SidebarNextContext.SidebarNextContext.Provider, {
              value: _objectSpread({
                skin: sidebarSkin,
                selectedKey: props.selectedKey,
                level: 1
              }, context),
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 226,
                columnNumber: 17
              }
            }, /*#__PURE__*/_react["default"].createElement(_SidebarItemNext["default"], (0, _extends2["default"])({}, commonProps, props, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 234,
                columnNumber: 19
              }
            }), /*#__PURE__*/_react["default"].createElement("div", {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 235,
                columnNumber: 21
              }
            }, sidebarSkin)));
          }));
        });
      });
    });
  });
});