/*
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 { Label as StyledLabel, Caption as StyledCaption } from '../styled-components.js';
describe('FormControl - Label and Caption for controls', function () {
  test('StyledLabel - basic render', function () {
    var component = shallow(React.createElement(StyledLabel, null, "Label"));
    expect(component.instance().getStyles()).toMatchSnapshot('StyledLabel has correct default styles');
    component.setProps({
      $disabled: true
    });
    expect(component.instance().getStyles()).toMatchSnapshot('StyledLabel has correct styles when compact and disabled');
  });
  test('StyledCaption - basic render', function () {
    var component = shallow(React.createElement(StyledCaption, null, "Caption"));
    expect(component.instance().getStyles()).toMatchSnapshot('StyledCaption has correct default styles');
    component.setProps({
      $error: true
    });
    expect(component.instance().getStyles()).toMatchSnapshot('StyledCaption has correct styles when compact and error is boolean');
    component.setProps({
      $error: 'Error message'
    });
    expect(component.instance().getStyles()).toMatchSnapshot('StyledCaption has correct styles when error is a string');
  });
});