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