UNPKG

@vectara/vectara-ui

Version:

Vectara's design system, codified as a React and Sass component library

41 lines (40 loc) 1.45 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { MemoryRouter } from "react-router-dom"; import "@testing-library/jest-dom"; import { VuiLink } from "./Link"; import { renderWithContext } from "../context/Context.test.util"; describe("VuiLink", () => { describe("track", () => { it("allows referrer information when true", () => { const { asFragment } = renderWithContext(_jsx(VuiLink, Object.assign({ href: "https://www.vectara.com", track: true }, { children: "Link" })), { wrapper: MemoryRouter }); expect(asFragment()).toMatchInlineSnapshot(` <DocumentFragment> <a class="vuiLink" href="https://www.vectara.com" referrerpolicy="no-referrer-when-downgrade" rel="noopener" > Link </a> </DocumentFragment> `); }); it("disallows referrer information when false (default)", () => { const { asFragment } = renderWithContext(_jsx(VuiLink, Object.assign({ href: "https://www.vectara.com" }, { children: "Link" })), { wrapper: MemoryRouter }); expect(asFragment()).toMatchInlineSnapshot(` <DocumentFragment> <a class="vuiLink" href="https://www.vectara.com" rel="noopener" > Link </a> </DocumentFragment> `); }); }); });