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.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.1 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.34.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.1 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.0.pre.alpha.PLAY1454formpillicons3309 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.33.0 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0.pre.alpha.PBNTR405dropdownformfixesrails3301 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0.pre.alpha.PLAY1138iconkitaddcolorprop3268 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0.pre.alpha.play1416movealiaslogic3266 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0.pre.alpha.play1416movealiaslogic3239 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.32.0.pre.alpha.PLAY14103236 app/pb_kits/playbook/pb_hashtag/hashtag.test.js
playbook_ui-13.31.0.pre.alpha.play1416movealiaslogic3232 app/pb_kits/playbook/pb_hashtag/hashtag.test.js