From caa5805d0f8c629e941cb81c86e4688a6f098cae Mon Sep 17 00:00:00 2001 From: benmartin-coforma <126210497+benmartin-coforma@users.noreply.github.com> Date: Wed, 11 Oct 2023 08:35:36 -0600 Subject: [PATCH] Minor content changes for 2023 (#139480) --- .../libs/validation/backend-section.schema.ts | 6 + .../data/seed/seed-section-base-2023.json | 151 +----------------- .../src/components/fields/Repeatables.js | 23 ++- .../src/components/fields/Repeatables.test.js | 52 ++++++ 4 files changed, 80 insertions(+), 152 deletions(-) create mode 100644 services/ui-src/src/components/fields/Repeatables.test.js diff --git a/services/app-api/libs/validation/backend-section.schema.ts b/services/app-api/libs/validation/backend-section.schema.ts index 0487e0345..6d91acc31 100644 --- a/services/app-api/libs/validation/backend-section.schema.ts +++ b/services/app-api/libs/validation/backend-section.schema.ts @@ -218,6 +218,12 @@ export const sectionSchema = { comment: { type: "string", }, + addAnotherText: { + type: ["string", "null"], + }, + hideOptionalHint: { + type: ["boolean", "null"], + }, questions: { type: "array", items: { diff --git a/services/database/data/seed/seed-section-base-2023.json b/services/database/data/seed/seed-section-base-2023.json index 943a81b58..79ed51125 100644 --- a/services/database/data/seed/seed-section-base-2023.json +++ b/services/database/data/seed/seed-section-base-2023.json @@ -1616,7 +1616,7 @@ "parts": [ { "id": "2023-02-a-01", - "text": "This table is pre-filled with your SEDS data for the two most recent federal fiscal years (FFY). If the information is inaccurate, adjust your data in SEDS (go to line 7: “Unduplicated Number Ever Enrolled” in your fourth quarter SEDS report) and then refresh this page. If you’re adjusting data in SEDS, allow one business day for the CARTS data below to update.", + "text": "This table is pre-filled with your SEDS data for the two most recent federal fiscal years (FFY). The percent change column in the table below calculates the rate of growth in enrollment over the previous federal fiscal year by subtracting the previous fiscal year enrollment total from the current fiscal year enrollment total (B - A), and dividing that by the previous fiscal year total (A). If the information is inaccurate, adjust your data in SEDS (go to line 7: “Unduplicated Number Ever Enrolled” in your fourth quarter SEDS report) and then refresh this page. If you’re adjusting data in SEDS, allow one business day for the CARTS data below to update.", "type": "part", "title": "Number of Children Enrolled in CHIP", "questions": [ @@ -1745,151 +1745,6 @@ "fieldset_id": "synthesized-table-2-2", "fieldset_info": { "rows": [ - [ - { - "contents": "2013" - }, - { - "lookupAcs": { - "ffy": "2013", - "acsProperty": "numberUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2013", - "acsProperty": "numberUninsuredMoe" - } - }, - { - "lookupAcs": { - "ffy": "2013", - "acsProperty": "percentUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2013", - "acsProperty": "percentUninsuredMoe" - } - } - ], - [ - { - "contents": "2014" - }, - { - "lookupAcs": { - "ffy": "2014", - "acsProperty": "numberUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2014", - "acsProperty": "numberUninsuredMoe" - } - }, - { - "lookupAcs": { - "ffy": "2014", - "acsProperty": "percentUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2014", - "acsProperty": "percentUninsuredMoe" - } - } - ], - [ - { - "contents": "2015" - }, - { - "lookupAcs": { - "ffy": "2015", - "acsProperty": "numberUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2015", - "acsProperty": "numberUninsuredMoe" - } - }, - { - "lookupAcs": { - "ffy": "2015", - "acsProperty": "percentUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2015", - "acsProperty": "percentUninsuredMoe" - } - } - ], - [ - { - "contents": "2016" - }, - { - "lookupAcs": { - "ffy": "2016", - "acsProperty": "numberUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2016", - "acsProperty": "numberUninsuredMoe" - } - }, - { - "lookupAcs": { - "ffy": "2016", - "acsProperty": "percentUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2016", - "acsProperty": "percentUninsuredMoe" - } - } - ], - [ - { - "contents": "2017" - }, - { - "lookupAcs": { - "ffy": "2017", - "acsProperty": "numberUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2017", - "acsProperty": "numberUninsuredMoe" - } - }, - { - "lookupAcs": { - "ffy": "2017", - "acsProperty": "percentUninsured" - } - }, - { - "lookupAcs": { - "ffy": "2017", - "acsProperty": "percentUninsuredMoe" - } - } - ], [ { "contents": "2018" @@ -8636,6 +8491,7 @@ "parts": [ { "id": "2023-03-i-01", + "title": "\u00A0", "type": "part", "questions": [ { @@ -8661,12 +8517,15 @@ }, { "id": "2023-03-i-02", + "title": "\u00A0", "text": "Please answer the following questions for all of the state's approved HSIs as listed in section 2.2 of the CHIP state plan.", "type": "part", "questions": [ { "id": "2023-03-i-02-01", "type": "repeatables", + "addAnotherText": "Does the state have additional HSIs to report?", + "hideOptionalHint": true, "questions": [ { "id": "2023-03-i-02-01-01", diff --git a/services/ui-src/src/components/fields/Repeatables.js b/services/ui-src/src/components/fields/Repeatables.js index ad3cd643c..14a13a72e 100644 --- a/services/ui-src/src/components/fields/Repeatables.js +++ b/services/ui-src/src/components/fields/Repeatables.js @@ -39,6 +39,15 @@ const Repeatables = ({ removeRepeatableFrom(question.id); }; + let doYouHaveAnotherVerbiage; + if (question.addAnotherText) { + doYouHaveAnotherVerbiage = question.addAnotherText; + } else if (question.typeLabel) { + doYouHaveAnotherVerbiage = `Do you have another ${question.typeLabel} in this list?`; + } else { + doYouHaveAnotherVerbiage = `Do you have another in this list?`; + } + return ( <> - Delete last {type || "item"} + Delete last {question.typeLabel || "item"} )}
- Do you have another{type ? ` ${type}` : ""} in this list? + {doYouHaveAnotherVerbiage} -
- Optional -
+ {!question.hideOptionalHint && ( +
+ Optional +
+ )}
diff --git a/services/ui-src/src/components/fields/Repeatables.test.js b/services/ui-src/src/components/fields/Repeatables.test.js new file mode 100644 index 000000000..edca85435 --- /dev/null +++ b/services/ui-src/src/components/fields/Repeatables.test.js @@ -0,0 +1,52 @@ +import React from "react"; +import { Provider } from "react-redux"; +import configureMockStore from "redux-mock-store"; +import Repeatables from "./Repeatables"; +import { screen, render } from "@testing-library/react"; + +const mockStore = configureMockStore(); +const store = mockStore({ lastYearTotals: { 2022: [] } }); +const renderQuestion = async (question) => + await render( + + + + ); + +describe("Repeatables", () => { + it("should render with default verbiage", async () => { + const question = { + typeLabel: "TypeLabel", + questions: [], + }; + await renderQuestion(question); + screen.getByText("Do you have another TypeLabel in this list?"); + screen.getByText("Optional"); + screen.getByText("Add another TypeLabel"); + }); + + it("should hide the Optional hint when specified", async () => { + const question = { + hideOptionalHint: true, + questions: [], + }; + await renderQuestion(question); + expect(screen.queryByText("Optional")).toBeNull(); + }); + + it("should use override verbiage when specified", async () => { + const question = { + addAnotherText: "Y'all got more or what?", + questions: [], + }; + await renderQuestion(question); + expect(screen.queryByText(/Do you have another/)).toBeNull(); + screen.getByText("Y'all got more or what?"); + }); +});