Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/misc/A.test.tsx
5803 views
1
import { render } from "@testing-library/react";
2
import A from "./A";
3
4
test("A opens a new tab at the right url", () => {
5
const { getByRole } = render(<A href="https://cocalc.com">CoCalc</A>);
6
const link = getByRole("link", { name: "CoCalc" });
7
8
// @ts-ignore
9
expect(link).toHaveAttribute("target", "_blank");
10
// @ts-ignore
11
expect(link).toHaveAttribute("href", "https://cocalc.com");
12
// @ts-ignore
13
expect(link).toHaveAttribute("rel", "noopener");
14
// @ts-ignore
15
expect(link).toHaveTextContent("CoCalc");
16
});
17
18