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