diff --git a/clients/admin-ui/cypress/e2e/privacy-experiences.cy.ts b/clients/admin-ui/cypress/e2e/privacy-experiences.cy.ts index 7020e9fc0e9..113fecf13be 100644 --- a/clients/admin-ui/cypress/e2e/privacy-experiences.cy.ts +++ b/clients/admin-ui/cypress/e2e/privacy-experiences.cy.ts @@ -176,17 +176,18 @@ describe("Privacy experiences", () => { }); interface Props { component?: "overlay" | "privacy_center"; + banner_title?: string; } /** * Helper function to swap out the component type in a stubbed experience * @example stubExperience({component: "overlay"}) */ - const stubExperience = ({ component }: Props) => { + const stubExperience = (overrides: Props) => { cy.fixture("privacy-experiences/experienceConfig.json").then( (experience) => { const updatedExperience = { ...experience, - component: component ?? experience.component, + ...overrides, }; cy.intercept("GET", "/api/v1/experience-config/pri*", { body: updatedExperience, @@ -285,6 +286,14 @@ describe("Privacy experiences", () => { }); }); + it("can still save when banner title is null", () => { + stubExperience({ component: "overlay", banner_title: null }); + cy.visit(`${PRIVACY_EXPERIENCE_ROUTE}/${OVERLAY_EXPERIENCE_ID}`); + cy.getByTestId("save-btn").should("be.disabled"); + cy.selectOption("input-banner_enabled", "Enabled where legally required"); + cy.getByTestId("save-btn").should("not.be.disabled"); + }); + it("can submit an overlay form excluding optional values", () => { stubExperience({ component: "overlay" }); cy.visit(`${PRIVACY_EXPERIENCE_ROUTE}/${OVERLAY_EXPERIENCE_ID}`); diff --git a/clients/admin-ui/src/features/privacy-experience/form/helpers.tsx b/clients/admin-ui/src/features/privacy-experience/form/helpers.tsx index 329420e2873..806b7d7c9ae 100644 --- a/clients/admin-ui/src/features/privacy-experience/form/helpers.tsx +++ b/clients/admin-ui/src/features/privacy-experience/form/helpers.tsx @@ -76,8 +76,8 @@ const bannerValidationSchema = Yup.object() privacy_preferences_link_label: Yup.string() .required() .label("Privacy preferences link label"), - banner_title: Yup.string().optional().label("Banner title"), - banner_description: Yup.string().optional().label("Banner description"), + banner_title: Yup.string().nullable().label("Banner title"), + banner_description: Yup.string().nullable().label("Banner description"), privacy_policy_link_label: Yup.string() .nullable() .label("Privacy policy link label"),