Skip to content

Commit

Permalink
remove status from RET HCBS section in review and submit page, make '…
Browse files Browse the repository at this point in the history
…not answered' text change for exported HCBS table
  • Loading branch information
britt-mo committed Jan 13, 2025
1 parent b07f025 commit 9007c43
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
8 changes: 5 additions & 3 deletions services/ui-src/src/components/export/ExportedRETTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Table } from "components";

// utils
import { useStore, sumOfRow, sumOfTwoRows, perOfTwoRows } from "utils";
import { notAnsweredText } from "../../constants";
import { notAnsweredText, optionalNotAnsweredText } from "../../constants";

export const generateMainTable = (
rows: AnyObject,
Expand Down Expand Up @@ -49,7 +49,6 @@ export const generateTableHeader = (rows: AnyObject, headerLabel: string) => {
.filter((keys) => {
return keys;
});

return [headerLabel, ...columnHeaders, "Total"];
};

Expand All @@ -61,10 +60,13 @@ export const generateTableBody = (rows: AnyObject, fieldData?: AnyObject) => {
let bodyRow: string[][] = firstCols;

bodyRow.forEach((row: string[]) => {
const sarHcbs = fieldData?.formId === "ret-hcbs";
const matchRow: [] = rows[row[0]];
const rowIds = matchRow.map((info: AnyObject) => info.id).flat();
rowIds.forEach((id) => {
const rowValue = fieldData?.[id] || notAnsweredText;
const rowValue =
fieldData?.[id] ||
(sarHcbs ? optionalNotAnsweredText : notAnsweredText);
row.push(rowValue);
});
});
Expand Down
10 changes: 10 additions & 0 deletions services/ui-src/src/components/statusing/TableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ReportPageProgress } from "types";
// utils
import { useStore } from "utils";
import {
mockRETTableRowPage,
mockTableRowPage,
mockUseStore,
RouterWrappedComponent,
Expand Down Expand Up @@ -69,5 +70,14 @@ describe("<TableRow />", () => {
).toBeVisible();
});

test("TableRow does not display status for RET HCBS", () => {
const sarHcbsText =
"Number of HCBS participants admitted to a facility from the community, by length of stay and age group";
mockedUseStore.mockReturnValue(mockUseStore);
render(tableRowComponent({ page: mockRETTableRowPage, rowDepth: 0 }));
expect(screen.getByText(sarHcbsText)).toBeVisible();
expect(screen.queryByAltText("Success notification")).toBeNull();
});

testA11y(tableRowComponent({ page: mockTableRowPage, rowDepth: 1 }));
});
4 changes: 3 additions & 1 deletion services/ui-src/src/components/statusing/TableRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Td, Text, Tr } from "@chakra-ui/react";
import { sarHcbsText } from "../../constants";
import { ReportPageProgress } from "types";
import { useBreakpoint, useStore } from "utils";
import { EditButton } from "./EditButton";
Expand All @@ -8,6 +9,7 @@ export const TableRow = ({ page, rowDepth }: RowProps) => {
const { isMobile } = useBreakpoint();
const { editable } = useStore();
const { name, path, children, status } = page;

const buttonAriaLabel = editable ? `Edit ${name}` : `View ${name}`;

const displayMobileEditButton = isMobile && !children?.length;
Expand Down Expand Up @@ -44,7 +46,7 @@ export const TableRow = ({ page, rowDepth }: RowProps) => {
sx={sx.statusColumn}
pt={rowDepth == 1 ? ptRowDepth1 : ptRowDepthOver1}
>
<StatusIcon status={status} />
{name !== sarHcbsText && <StatusIcon status={status} />}
</Td>
{displayDefaultEditButton && (
<Td>
Expand Down
4 changes: 4 additions & 0 deletions services/ui-src/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const dropdownDefaultOptionText = "- Select an option -";
export const closeText = "Close";
export const saveAndCloseText = "Save & close";
export const notAnsweredText = "Not answered";
export const optionalNotAnsweredText = "Not answered; optional";

export const sarHcbsText =
"Number of HCBS participants admitted to a facility from the community, by length of stay and age group";

// STATES
export enum States {
Expand Down
5 changes: 5 additions & 0 deletions services/ui-src/src/utils/testing/mockForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,11 @@ export const mockTableRowPage = {
status: true,
};

export const mockRETTableRowPage = {
name: "Number of HCBS participants admitted to a facility from the community, by length of stay and age group",
path: "/sar/recruitment-enrollment-transitions/number-of-hcbs-participants-admitted-to-facility-from-community",
};

export const mockChildRowPage = {
name: "State or Territory-Specific Initiatives",
path: "/wp/state-or-territory-specific-initiatives/initiatives",
Expand Down

0 comments on commit 9007c43

Please sign in to comment.