/*
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 */
import React from 'react';
import { shallow } from 'enzyme';
import { Icon } from '../index.js';
import { Svg } from '../styled-components.js';
import * as Icons from '../icon-exports.js';
describe('Icon', function () {
  test('renders an icon with viewbox and title', function () {
    var wrapper = shallow(React.createElement(Icon, {
      viewBox: "0 0 23px 23px",
      title: "Test"
    }, React.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 = shallow(React.createElement(Icon, {
      overrides: {
        Svg: {
          style: {
            fill: 'purple'
          }
        }
      }
    }, React.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(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 = shallow(React.createElement(Component, null));
      expect(wrapper).toExist();
    });
  });
});