"use strict";

var _reactNative = require("@testing-library/react-native");
var _react = _interopRequireDefault(require("react"));
var _reactTestRenderer = _interopRequireDefault(require("react-test-renderer"));
var _themeContext = require("../../../theme/src/theme-context");
var _box = _interopRequireDefault(require("../box/box"));
var _stack = _interopRequireDefault(require("../stack/stack"));
var _spinner = _interopRequireDefault(require("./spinner"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.useFakeTimers();
describe("Atoms/Spinner", () => {
  it("passes the snapshot test for different sizes", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_spinner.default, {
      size: "xs"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      size: "s"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      size: "m"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      size: "l"
    }))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for different variants", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "activity"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "ball"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "bar"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "dot"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "pacman"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "pulse"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "skype"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "spinner"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      variant: "wave"
    }))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for different color schemes", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_spinner.default, {
      colorScheme: "primary"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      colorScheme: "success"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      colorScheme: "warning"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      colorScheme: "info"
    }), /*#__PURE__*/_react.default.createElement(_spinner.default, {
      colorScheme: "danger"
    }))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test if the spinner is expanded or not", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_stack.default, {
      direction: "vertical",
      spacing: "l"
    }, /*#__PURE__*/_react.default.createElement(_box.default, {
      w: 200,
      h: 100,
      backgroundColor: "neutral.200"
    }, /*#__PURE__*/_react.default.createElement(_spinner.default, null)), /*#__PURE__*/_react.default.createElement(_box.default, {
      w: 200,
      h: 100,
      backgroundColor: "neutral.200"
    }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
      isExpanded: true
    }))))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("doesn't render when not loading", () => {
    const tree = _reactTestRenderer.default.create( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_spinner.default, {
      isLoading: false
    }))).toJSON();
    expect(tree.children).toBe(null);
  });
  it("renders when loading", () => {
    let comp;
    _reactTestRenderer.default.act(() => {
      comp = _reactTestRenderer.default.create( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_spinner.default, null)));
    });
    const tree = comp.toJSON();
    expect(tree.children.length).toBe(1);
  });
});
//# sourceMappingURL=spinner.spec.js.map