Skip to content

Commit

Permalink
fix:CTA test
Browse files Browse the repository at this point in the history
  • Loading branch information
numbap committed May 31, 2023
1 parent 515ead4 commit a18cdb9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"focus-trap-react": "^10.1.1",
"git-conventional-commits": "^2.6.3",
"identity-obj-proxy": "^3.0.0",
"prop-types": "^15.7.2",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-app-polyfill": "^3.0.0",
"react-bootstrap": "^2.7.4",
Expand Down Expand Up @@ -147,4 +147,4 @@
"web-vitals": "^1.1.2",
"webpack": "^5.76.0"
}
}
}
26 changes: 26 additions & 0 deletions src/components/CTA/CTA.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { Default, WithoutLink } from "./CTA.stories";
import "@testing-library/jest-dom/extend-expect";
import { axe, toHaveNoViolations } from "jest-axe";
import { render, screen } from "@testing-library/react";

expect.extend(toHaveNoViolations);

describe("CTA", () => {
it("renders and formats the date properly", () => {
render(<Default {...Default.args} />);
screen.getByText("Action Button");
});

it("renders and formats the date properly", () => {
render(<WithoutLink {...WithoutLink.args} />);
screen.getByText("This is a call-to-action!");
});

// it("has no a11y violations", async () => {
// const { container } = render(<Default {...Default.args} />);
// const results = await axe(container);

// expect(results).toHaveNoViolations();
// });
});
5 changes: 3 additions & 2 deletions src/components/CTA/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Image } from "../Image/Image";
import commentBubble from "../../assets/comment_bubble.svg";
import { Button } from "../Button/Button";
import { Link } from "../Link/Link";
import PropTypes from "prop-types";

export interface ICTAProps {
heading: string;
body: string;
ButtonProps: typeof Button.propTypes;
LinkProps?: typeof Link.propTypes;
ButtonProps: PropTypes.InferProps<typeof Button.propTypes>;
LinkProps?: PropTypes.InferProps<typeof Link.propTypes>;
containerClass?: string;
}

Expand Down

0 comments on commit a18cdb9

Please sign in to comment.