Sha256: 69ddabe457a87734a4d703030c4281df227f89632d09925369e5e7fb2cba8708

Contents?: true

Size: 1.46 KB

Versions: 529

Compression:

Stored size: 1.46 KB

Contents

import React from 'react'
import { render, screen, cleanup } from "../utilities/test-utils";

import { Hashtag } from "..";


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

529 entries across 529 versions & 1 rubygems

Version Path
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3231 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3230 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3172 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3171 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.30.0.pre.alpha.play1367contenttagnoninputkits3159 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.30.0.pre.alpha.20240515remotebuildkitconversion3150 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.30.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.29.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js