Skip to content

Commit

Permalink
Minor content changes for 2023 (#139480)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmartin-coforma authored Oct 11, 2023
1 parent 5c21cb3 commit caa5805
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 152 deletions.
6 changes: 6 additions & 0 deletions services/app-api/libs/validation/backend-section.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ export const sectionSchema = {
comment: {
type: "string",
},
addAnotherText: {
type: ["string", "null"],
},
hideOptionalHint: {
type: ["boolean", "null"],
},
questions: {
type: "array",
items: {
Expand Down
151 changes: 5 additions & 146 deletions services/database/data/seed/seed-section-base-2023.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -8636,6 +8491,7 @@
"parts": [
{
"id": "2023-03-i-01",
"title": "\u00A0",
"type": "part",
"questions": [
{
Expand All @@ -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",
Expand Down
23 changes: 17 additions & 6 deletions services/ui-src/src/components/fields/Repeatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Accordion
Expand All @@ -64,26 +73,28 @@ const Repeatables = ({
type="button"
className="add-objective ds-c-button ds-c-button--danger"
>
Delete last {type || "item"}
Delete last {question.typeLabel || "item"}
</button>
)}
</Accordion>

<div className="section-footer">
<span className="question-inner-header span-pdf-no-bookmark">
Do you have another{type ? ` ${type}` : ""} in this list?
{doYouHaveAnotherVerbiage}
</span>

<div className="ds-c-field__hint" aria-label="Hint">
Optional
</div>
{!question.hideOptionalHint && (
<div className="ds-c-field__hint" aria-label="Hint">
Optional
</div>
)}
<button
disabled={disabled}
onClick={add}
type="button"
className="add-objective ds-c-button ds-c-button--primary"
>
Add another{type && ` ${type}`}
Add another{question.typeLabel && ` ${question.typeLabel}`}
<FontAwesomeIcon icon={faPlus} />
</button>
</div>
Expand Down
52 changes: 52 additions & 0 deletions services/ui-src/src/components/fields/Repeatables.test.js
Original file line number Diff line number Diff line change
@@ -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(
<Provider store={store}>
<Repeatables
question={question}
type={null}
disabled={false}
addRepeatableTo={jest.fn()}
removeRepeatableFrom={jest.fn()}
></Repeatables>
</Provider>
);

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?");
});
});

0 comments on commit caa5805

Please sign in to comment.