Skip to content

Commit

Permalink
fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Jun 28, 2022
1 parent 3adc06a commit 1929007
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions spotlight-client/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("navigation", () => {
test("tenant home", () => {
expect.hasAssertions();
const targetPath = "/us-nd";
const lookupArgs = ["heading", { name: /DOCR/, level: 1 }] as const;
const lookupArgs = ["heading", { name: /DOCR/, level: 2 }] as const;

return verifyWithNavigation({ targetPath, lookupArgs });
});
Expand Down Expand Up @@ -142,7 +142,9 @@ describe("navigation", () => {

fireEvent.click(tenantLink);
await waitFor(async () =>
expect(await screen.findByTestId("PageTitle")).toHaveTextContent("DOCR")
expect(await screen.findByTestId("PageTitle")).toHaveTextContent(
"transform lives, influence change,"
)
);

expect(screen.queryByText("Sentencing Data")).not.toBeInTheDocument();
Expand Down
14 changes: 11 additions & 3 deletions spotlight-client/src/PageTenant/PageTenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// =============================================================================

import { RouteComponentProps } from "@reach/router";
import { Body19, typography } from "@recidiviz/design-system";
import { typography } from "@recidiviz/design-system";
import HTMLReactParser from "html-react-parser";
import { observer } from "mobx-react-lite";
import { rem } from "polished";
Expand Down Expand Up @@ -90,6 +90,10 @@ const Title = styled.h1`
}
`;

const Subtitle = styled.h2`
${typography.Body19}
`;

const PageTenant: React.FC<RouteComponentProps> = () => {
const { tenant } = useDataStore();
const [narrativeId, setNarrativeId] = React.useState<NarrativeTypeId>(
Expand All @@ -102,8 +106,12 @@ const PageTenant: React.FC<RouteComponentProps> = () => {
// tenant may be briefly undefined during initial page load
<Page>
<Introduction>
<Title>{HTMLReactParser(tenant.description)}</Title>
{tenant.ctaCopy && <Body19>{HTMLReactParser(tenant.ctaCopy)}</Body19>}
<Title data-testid="PageTitle">
{HTMLReactParser(tenant.description)}
</Title>
{tenant.ctaCopy && (
<Subtitle>{HTMLReactParser(tenant.ctaCopy)}</Subtitle>
)}
<ExploreNarrativeButton
narrativeId={narrativeId}
tenantId={tenant.id}
Expand Down

0 comments on commit 1929007

Please sign in to comment.