"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _Spinner = _interopRequireDefault(require("../Spinner"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
describe('Spinner Specs', function () {
  test('should have transparentBackground class when transparent prop equals true', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      transparent: true
    }));
    var expected = 'transparentBackground';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should center the Spinner when centered prop equals true', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      centered: true
    }));
    var expected = 'centered';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have pausedAnimation class when paused prop equals true', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      paused: true
    }));
    var expected = 'pausedAnimation';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have loading class when type prop equals `loading`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      type: "loading"
    }));
    var expected = 'loading';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have smallest class when size prop equals `smallest`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      size: "smallest"
    }));
    var expected = 'smallest';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have small class when size prop equals `small`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      size: "small"
    }));
    var expected = 'small';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have large class by default', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {}));
    var expected = 'large';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have huge class when size prop equals `huge`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      size: "huge"
    }));
    var expected = 'huge';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should have dark class when color prop equals `dark`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      color: "dark"
    }));
    var expected = 'dark';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
  test('should set role to alert by default', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {}));
    var actual = _react.screen.getByRole('alert');
    expect(actual).toBeInTheDocument();
  });
  test('should set aria-live to off by default', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {}));
    var expected = 'off';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveAttribute('aria-live', expected);
  });
  test('should not have client node when Spinner has no children', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {}));
    var expected = 1;
    var expectedClass = 'client';
    var actual = _react.screen.getByRole('alert').children;
    expect(actual).toHaveLength(expected);
    expect(actual[0]).not.toHaveClass(expectedClass);
  });
  test('should have a client node when Spinner has children', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      children: "Loading..."
    }));
    var expected = 2;
    var expectedClass = 'client';
    var actual = _react.screen.getByRole('alert').children;
    expect(actual).toHaveLength(expected);
    expect(actual[1]).toHaveClass(expectedClass);
  });
  test('should have content class when Spinner has children', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
      children: "Loading..."
    }));
    var expected = 'content';
    var actual = _react.screen.getByRole('alert');
    expect(actual).toHaveClass(expected);
  });
});