From 805f030323e7543972eeb8f1654f4efe1164bdc2 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:31:26 +0000 Subject: [PATCH] Reword error message and remove min max from validation --- .../Feedback/Public/tests/Public.submit.test.tsx | 2 +- .../src/@planx/components/Feedback/model.ts | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Feedback/Public/tests/Public.submit.test.tsx b/editor.planx.uk/src/@planx/components/Feedback/Public/tests/Public.submit.test.tsx index 586d728b8f..abbf2b084f 100644 --- a/editor.planx.uk/src/@planx/components/Feedback/Public/tests/Public.submit.test.tsx +++ b/editor.planx.uk/src/@planx/components/Feedback/Public/tests/Public.submit.test.tsx @@ -87,7 +87,7 @@ describe("when feedback is required but the user does not submit any data", asyn it("displays an appropriate error message for each missing field", async () => { const errorMessages = [ - "Please provide a feedback score", + "Please rate your experience", "Enter your feedback", ]; errorMessages.map((error) => { diff --git a/editor.planx.uk/src/@planx/components/Feedback/model.ts b/editor.planx.uk/src/@planx/components/Feedback/model.ts index ad5247e454..daeaa81124 100644 --- a/editor.planx.uk/src/@planx/components/Feedback/model.ts +++ b/editor.planx.uk/src/@planx/components/Feedback/model.ts @@ -34,14 +34,7 @@ export const createFeedbackSchema = (feedbackRequired: boolean) => { ? string().required("Enter your feedback") : string(), feedbackScore: feedbackRequired - ? number() - .integer() - .min(1, "Feedback score must be at least 1") - .max(5, "Feedback score cannot exceed 5") - .required("Please provide a feedback score") - : number() - .integer() - .min(1, "Feedback score must be at least 1") - .max(5, "Feedback score cannot exceed 5"), + ? number().integer().required("Please rate your experience") + : number().integer(), }); };