Sha256: f33a4ab3b31b346dd43b56efe56e2294b220fe1176279a932bb0f9bbeaf8af22
Contents?: true
Size: 1.47 KB
Versions: 482
Compression:
Stored size: 1.47 KB
Contents
import React from 'react' import { render, screen, cleanup } from "../utilities/test-utils"; import { Hashtag } from "playbook-ui"; const testId = "primary-test" const text="Open in a new window" const type="project" const url="https://google.com" const typeMap = { home: 'H#', project: 'P#', appointment: 'A#', default: '#', } function HashtagTest(props) { return ( <Hashtag data={{ testid: testId }} text={text} type={type} url={url} {...props} /> ); } test("renders the component", () => { render(<HashtagTest/>); const kit = screen.getByTestId("primary-test"); expect(kit).toBeInTheDocument(); expect(kit).toHaveClass("pb_hashtag_kit"); cleanup() }); test("should pass in url property and allow links to open in a new window", () => { const { container } = render(<HashtagTest newWindow />); expect(container.getElementsByClassName("pb_hashtag_kit")[0].firstChild).toHaveAttribute("href", url); expect(container.getElementsByClassName("pb_hashtag_kit")[0].firstChild).toHaveAttribute("target", "_blank"); cleanup() }); test("renders the badge kit with appropriate text", () => { const { container } = render(<HashtagTest />); expect(container.getElementsByClassName("pb_badge_kit_primary")[0]).toBeInTheDocument; expect(container.getElementsByClassName("pb_badge_kit_primary")[0]).toHaveTextContent(typeMap[type] + text); cleanup() });
Version data entries
482 entries across 482 versions & 1 rubygems