From 68407a38e30a012ea568de48b078ffc7ab759847 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:01:55 +0000 Subject: [PATCH] fix: add default disclaimer text to shared component (#3984) --- .../PlanningConstraints/Presentational.tsx | 11 +++++-- .../PlanningConstraints/Public.test.tsx | 17 +++++++++++ .../@planx/components/shared/Disclaimer.tsx | 29 ++++++++++++++----- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Presentational.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Presentational.tsx index 75d0ef93c7..01dcb50008 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Presentational.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Presentational.tsx @@ -10,6 +10,7 @@ import { Disclaimer } from "../shared/Disclaimer"; import { ErrorSummaryContainer } from "../shared/Preview/ErrorSummaryContainer"; import SimpleExpand from "../shared/Preview/SimpleExpand"; import ConstraintsList from "./List"; +import { DEFAULT_PLANNING_CONDITIONS_DISCLAIMER } from "./model"; import { InaccurateConstraints } from "./Public"; export type PresentationalProps = { @@ -80,7 +81,10 @@ export function Presentational(props: PresentationalProps) { /> )} - + )} {positiveConstraints.length === 0 && negativeConstraints.length > 0 && ( @@ -110,7 +114,10 @@ export function Presentational(props: PresentationalProps) { setInaccurateConstraints={setInaccurateConstraints} /> - + )} diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx index eb3e1e4a11..c089162194 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx @@ -239,4 +239,21 @@ describe("following a FindProperty component", () => { expect(negativeConstraintsContainer).toBeVisible(); expect(getByRole("heading", { name: /Ecology/ })).toBeVisible(); }); + + test("default disclaimer text should render if none provided", async () => { + const { queryByText } = setup( + , + ); + expect( + queryByText( + "This page does not include information about historic planning conditions that may apply to this property.", + ), + ).toBeVisible(); + }); }); diff --git a/editor.planx.uk/src/@planx/components/shared/Disclaimer.tsx b/editor.planx.uk/src/@planx/components/shared/Disclaimer.tsx index 46706de43b..d7d176815e 100644 --- a/editor.planx.uk/src/@planx/components/shared/Disclaimer.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Disclaimer.tsx @@ -4,11 +4,24 @@ import { WarningContainer } from "@planx/components/shared/Preview/WarningContai import React from "react"; import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml/ReactMarkdownOrHtml"; -export const Disclaimer = ({ text }: { text: string }) => ( - - - - - - -); +export const Disclaimer = ({ + text, + defaultText, +}: { + text: string; + defaultText?: string; +}) => { + return ( + + + + + + + ); +};