/*
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 { shallow } from 'enzyme';
import { StyledRoot, StyledLabel, StyledCheckmark, StyledInput } from '../index.js';
describe('Checkbox styled components', function () {
  describe('StyledLabel', function () {
    test.each([[''], ['disabled'], ['$isError']])('', function (prop) {
      var props = {};
      props[prop] = true;
      var component = shallow(React.createElement(StyledLabel, props, React.createElement("div", null)));
      expect(component.instance().getStyles()).toMatchSnapshot('has correct styles when ' + prop);
    });
  });
  describe('StyledLabel', function () {
    test('Label', function () {
      var component = shallow(React.createElement(StyledLabel, null, React.createElement("div", null)));
      ['left', 'right', 'top', 'bottom'].forEach(function (labelPlacement) {
        component.setProps({
          $labelPlacement: labelPlacement
        });
        expect(component.instance().getStyles()).toMatchSnapshot('StyledLabel has correct styles when set to ' + labelPlacement);
      });
    });
  });
  describe('StyledCheckmark', function () {
    test.each([[''], ['$disabled'], ['$disabled', '$checked'], ['$isIndeterminate'], ['$isFocused'], ['$isActive'], ['$isHovered'], ['$checked'], ['$checked', '$isHovered'], ['$checked', '$isActive'], ['$checked', '$isFocused'], ['$isError'], ['$isError', '$checked'], ['$isError', '$checked', '$isHovered'], ['$isError', '$checked', '$isActive'], ['$isError', '$checked', '$isFocused'], ['$isError', '$isHovered'], ['$isError', '$isActive'], ['$isError', '$isFocused']])('', function () {
      var passedProps = {};

      for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) {
        props[_key] = arguments[_key];
      }

      props.map(function (prop) {
        passedProps[prop] = true;
      });
      var component = shallow(React.createElement(StyledCheckmark, passedProps, React.createElement("div", null)));
      expect(component.instance().getStyles()).toMatchSnapshot('has correct styles when ' + props.join(' '));
    });
  });
  describe('StyledInput', function () {
    test('', function () {
      var component = shallow(React.createElement(StyledInput, null, React.createElement("div", null)));
      expect(component.instance().getStyles()).toMatchSnapshot('StyledInput has correct styles');
    });
  });
  describe('StyledRoot', function () {
    test('', function () {
      var component = shallow(React.createElement(StyledRoot, null, React.createElement("div", null)));
      expect(component.instance().getStyles()).toMatchSnapshot('StyledRoot has correct styles');
    });
    test.each([['top'], ['bottom'], ['left'], ['right']])('', function (prop) {
      var props = {
        $labelPlacement: prop
      };
      var component = shallow(React.createElement(StyledRoot, props, React.createElement("div", null)));
      expect(component.instance().getStyles()).toMatchSnapshot('has correct styles when label is placed' + prop);
    });
  });
});