-
Notifications
You must be signed in to change notification settings - Fork 275
/
Copy pathAllLoaders.test.tsx
30 lines (24 loc) · 1.05 KB
/
AllLoaders.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import * as React from "react";
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
import * as Loaders from "../src";
import { LoaderHeightWidthRadiusProps, LoaderSizeMarginProps } from "../src/helpers/props";
Object.entries(Loaders).forEach((loader) => {
const name = loader[0];
const Loader = loader[1] as React.ComponentType<LoaderHeightWidthRadiusProps & LoaderSizeMarginProps>;
describe(name, () => {
it("should render nothing is loading prop is false", () => {
const { container } = render(<Loader loading={false} />);
expect(container.firstChild).toBeNull();
});
it("should have allow style override on wrapper", () => {
const style = { overflow: "scroll" };
const { container } = render(<Loader cssOverride={style} />);
expect(container.firstChild).toHaveStyle(style);
});
it("should have allow custom html props", () => {
render(<Loader aria-label={"aria-label"} />);
expect(screen.queryByLabelText("aria-label")).toBeTruthy();
});
});
});