diff --git a/package.json b/package.json index a507dda9e..1a4f6cde0 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@storybook/react": "6.0.21", "@testing-library/jest-dom": "5.11.4", "@testing-library/react": "11.0.2", - "@testing-library/react-hooks": "3.4.1", + "@testing-library/react-hooks": "^3.4.1", "@types/jest": "26.0.13", "@types/jest-axe": "3.5.0", "@types/react": "16.9.49", diff --git a/src/progress/__tests__/Progress.test.tsx b/src/progress/__tests__/Progress.test.tsx new file mode 100644 index 000000000..04d1c512e --- /dev/null +++ b/src/progress/__tests__/Progress.test.tsx @@ -0,0 +1,51 @@ +import * as React from "react"; +import { axe } from "jest-axe"; +import { render } from "reakit-test-utils"; + +import { Progress, ProgressProps, useProgressState } from ".."; + +const ProgressComp = (props: Partial) => { + const progress = useProgressState(props); + + return ( +
+ +
+ ); +}; + +describe("Progress", () => { + it("should render correctly", () => { + const { baseElement } = render(); + + expect(baseElement).toMatchInlineSnapshot(` + +
+
+
+
+
+ + `); + }); + + it("should render isIndeterminate", () => { + const { getByTestId: testid } = render(); + + expect(testid("progress")).toHaveAttribute("data-indeterminate", ""); + }); + + test("Progress renders with no a11y violations", async () => { + const { container } = render(); + const results = await axe(container); + + expect(results).toHaveNoViolations(); + }); +});