"use strict";

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _index = require("../index");

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

var Icons = _interopRequireWildcard(require("../icon-exports"));

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; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
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.
*/

/* eslint-env browser */
describe('Icon', function () {
  test('renders an icon with viewbox and title', function () {
    var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_index.Icon, {
      viewBox: "0 0 23px 23px",
      title: "Test"
    }, _react.default.createElement("path", {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z"
    })));
    expect(wrapper).toMatchSnapshot('Icon basic render');
  });
  test('supports overrides', function () {
    var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_index.Icon, {
      overrides: {
        Svg: {
          style: {
            fill: 'purple'
          }
        }
      }
    }, _react.default.createElement("path", {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z"
    })));
    expect(wrapper.find(_styledComponents.Svg).prop('$style')).toEqual({
      fill: 'purple'
    });
  }); // Test that all the icons render

  Object.keys(Icons).forEach(function (key) {
    var Component = Icons[key];
    test("renders ".concat(key, " icon"), function () {
      var wrapper = (0, _enzyme.shallow)(_react.default.createElement(Component, null));
      expect(wrapper).toExist();
    });
  });
});