"use strict";

var React = _interopRequireWildcard(require("react"));

var _enzyme = require("enzyme");

var _styledComponents = require("../styled-components.js");

var _constants = require("../constants.js");

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

/*
Copyright (c) 2018 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
function makeTest(_ref) {
  var title = _ref.title,
      Component = _ref.component,
      _ref$props = _ref.props,
      props = _ref$props === void 0 ? {} : _ref$props,
      _ref$children = _ref.children,
      children = _ref$children === void 0 ? null : _ref$children,
      _ref$snapshotName = _ref.snapshotName,
      snapshotName = _ref$snapshotName === void 0 ? 'correct styles' : _ref$snapshotName;
  test(title, function () {
    var shallowed = (0, _enzyme.shallow)(React.createElement(Component, props, children));
    expect(shallowed.instance().getStyles()).toMatchSnapshot(snapshotName);
  });
}

describe('Menu Styled Components', function () {
  makeTest({
    title: 'ListItem - basic render',
    component: _styledComponents.ListItem
  });
  makeTest({
    title: 'ListItem - highlighted render',
    component: _styledComponents.ListItem,
    props: {
      $isHighlighted: true
    }
  });
  makeTest({
    title: 'ListItem - compact',
    component: _styledComponents.ListItem,
    props: {
      $size: _constants.OPTION_LIST_SIZE.compact
    }
  });
  makeTest({
    title: 'List - basic render',
    component: _styledComponents.List
  });
  makeTest({
    title: 'ListItemProfile - basic render',
    component: _styledComponents.ListItemProfile
  });
  makeTest({
    title: 'ProfileImgContainer - basic render',
    component: _styledComponents.ProfileImgContainer
  });
  makeTest({
    title: 'ProfileImg - basic render',
    component: _styledComponents.ProfileImg
  });
  makeTest({
    title: 'ProfileLabelsContainer - basic render',
    component: _styledComponents.ProfileLabelsContainer
  });
  makeTest({
    title: 'ProfileTitle - basic render',
    component: _styledComponents.ProfileTitle
  });
  makeTest({
    title: 'ProfileSubtitle - basic render',
    component: _styledComponents.ProfileSubtitle
  });
  makeTest({
    title: 'ProfileBody - basic render',
    component: _styledComponents.ProfileBody
  });
});