import React from "react"; import { render } from "@testing-library/react"; import { createSerializer } from "@emotion/jest"; import { CaptionText, DangerText, HeadingText1, HeadingText2, HeadingText3, InteractiveText, MonospaceText, SmallText, SuccessText, Text, TextBlock, WarningText } from "../"; expect.addSnapshotSerializer(createSerializer()); const allComponents = [ Text, CaptionText, DangerText, HeadingText1, HeadingText2, HeadingText3, InteractiveText, MonospaceText, SmallText, SuccessText, WarningText ]; describe("Typography", () => { it("renders all default", () => { allComponents.forEach(component => { const TypographyComponent = component; const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("Text", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); it("renders all wrap variants", () => { type WrapVariant = "truncate" | "nowrap" | "wrap"; ["truncate", "nowrap", "wrap"].forEach(wrapVariant => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); }); describe("CaptionText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("DangerText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("HeadingText", () => { it("renders all props all HeadingText variants", () => { [HeadingText1, HeadingText2, HeadingText3].forEach(component => { const HeadingComponent = component; const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); }); describe("InteractiveText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("MonospaceText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("SmallText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("SuccessText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("WarningText", () => { it("renders all props", () => { const { asFragment } = render( content ); expect(asFragment()).toMatchSnapshot(); }); }); describe("TextBlock", () => { it("renders all props", () => { const { asFragment } = render(

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

); expect(asFragment()).toMatchSnapshot(); }); }); });