"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));

var React = _interopRequireWildcard(require("react"));

var _react2 = require("@testing-library/react");

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

var _templateObject;

describe('Skeleton', function () {
  afterEach(_react2.cleanup);
  test('should render with default props', function () {
    var _render = (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default, null)),
        container = _render.container;

    expect(container).toMatchSnapshot();
  });
  it('should render radius shape skeleton', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default, {
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton za-skeleton--radius');
  });
  test.each(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n    className            | shape       | expected\n    ", " | ", " | ", "\n    ", " | ", " | ", "\n    ", " | ", "   | ", "\n  "])), 'custom-skeleton', 'circle', 'za-skeleton za-skeleton--circle custom-skeleton', 'custom-skeleton', 'radius', 'za-skeleton za-skeleton--radius custom-skeleton', 'custom-skeleton', 'rect', 'za-skeleton za-skeleton--rect custom-skeleton')('should render with className - $className and shape - $shape', function (_ref) {
    var className = _ref.className,
        shape = _ref.shape,
        expected = _ref.expected;
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default, {
      "data-testid": "skeleton-root",
      className: className,
      shape: shape
    }));
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual(expected);
  });
  it('should render animated skeleton', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default, {
      animated: true,
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton za-skeleton--radius za-skeleton--animated');
  });
  it('should render Skeleton.Title', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Title, {
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton za-skeleton--radius za-skeleton__title');
  });
  it('should render rect Skeleton.Title', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Title, {
      shape: "rect",
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton za-skeleton--rect za-skeleton__title');
  });
  it('should render animated Skeleton.Title', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Title, {
      animated: true,
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton za-skeleton--radius za-skeleton--animated za-skeleton__title');
  });
  it('should render Skeleton.Paragraph', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Paragraph, {
      lineCount: 5,
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').className).toEqual('za-skeleton__paragraph');
    expect(_react2.screen.getByTestId('skeleton-root').firstElementChild.className).toEqual('za-skeleton za-skeleton--radius za-skeleton__line');
    expect(_react2.screen.getByTestId('skeleton-root').childElementCount).toBe(5);
  });
  it('should render animated Skeleton.Paragraph', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Paragraph, {
      animated: true,
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').firstElementChild.className).toEqual('za-skeleton za-skeleton--radius za-skeleton--animated za-skeleton__line');
  });
  it('should render rect Skeleton.Paragraph', function () {
    (0, _react2.render)( /*#__PURE__*/React.createElement(_index.default.Paragraph, {
      shape: "rect",
      "data-testid": "skeleton-root"
    }));
    expect(_react2.screen.getByTestId('skeleton-root')).toBeTruthy();
    expect(_react2.screen.getByTestId('skeleton-root').firstElementChild.className).toEqual('za-skeleton za-skeleton--rect za-skeleton__line');
  });
});