/*
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.
*/
import React from 'react';
import { mount } from 'enzyme';
import { Spinner } from '../index.js';
import { Spinner as SpinnerIcon } from '../../icon/index.js';
describe('Spinner', function () {
  test('renders spinner icon', function () {
    var renderedIcon;
    var spinner = mount(React.createElement(Spinner, null)); // renderedRoot = wrapper.find(StyledSvg).first();

    renderedIcon = spinner.find(SpinnerIcon).first();
    expect(renderedIcon).toExist(); // pass new size value set to 56

    spinner.setProps({
      size: 56
    });
    renderedIcon = spinner.find(SpinnerIcon).first();
    expect(renderedIcon.props().size).toBe(56);
  });
  test('component overrides', function () {
    var overrides = {
      Svg: jest.fn().mockImplementation(function (_ref) {
        var children = _ref.children;
        return React.createElement("svg", null, children);
      })
    };
    var wrapper = mount( // $FlowFixMe
    React.createElement(Spinner, {
      overrides: overrides
    }));
    var root = wrapper.find(overrides.Svg);
    expect(root).toHaveLength(1);
  });
});