Skip to content

Commit

Permalink
fix(ui): val fixes for Temporary Extension (#863)
Browse files Browse the repository at this point in the history
* fix: swap `waiverId` and `authority`

* chore: add test for label/value order

* fix: re-add missing `defaultValues`
  • Loading branch information
asharonbaltazar authored Nov 20, 2024
1 parent e9bf71a commit fe19691
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
12 changes: 10 additions & 2 deletions react-app/src/features/forms/waiver/temporary-extension/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const TemporaryExtensionForm = () => {
{submission ? (
<div>
<p>Approved Initial or Renewal Waiver Number</p>
<p className="text-xl">{submission._source.authority}</p>
<p className="text-xl">{waiverId}</p>
</div>
) : (
<FormField
Expand Down Expand Up @@ -67,7 +67,7 @@ export const TemporaryExtensionForm = () => {
{waiverId && submission ? (
<div>
<p>Temporary Extension Type</p>
<p className="text-xl">{waiverId}</p>
<p className="text-xl">{submission._source.authority}</p>
</div>
) : (
<FormField
Expand Down Expand Up @@ -146,6 +146,14 @@ export const TemporaryExtensionForm = () => {
/>
</>
)}
defaultValues={{
ids: {
validAuthority: {
authority: submission?._source?.authority ?? "",
waiverNumber: waiverId ?? "",
},
},
}}
attachments={{
faqLink: getFAQLinkForAttachments("temporary-extension"),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,24 @@ describe("Temporary Extension", () => {
renderFormWithPackageSection(<TemporaryExtensionForm />);

// "Medicaid SPA" comes from `useGetItem` in testing/setup.ts
const waiverNumberLabel = screen.getByText("Medicaid SPA");
const existentIdLabel = screen.getByText(/Temporary Extension Type/);
const temporaryExtensionLabel = screen.getByText(/Temporary Extension Type/);
const temporaryExtensionValue = screen.getByText("Medicaid SPA");

expect(waiverNumberLabel).toBeInTheDocument();
expect(existentIdLabel).toBeInTheDocument();
// ensure Temporary Extension label and value exist and are in correct order
expect(temporaryExtensionLabel.compareDocumentPosition(temporaryExtensionValue)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING,
);

const approvedInitialAndRenewalLabel = screen.getByText(
"Approved Initial or Renewal Waiver Number",
);
// grab second 12345 (first one is in the breadcrumbs)
const approvedInitialAndRenewalValue = screen.getAllByText(/12345/)[1];

// ensure Approved Initial and Renewal label and value exist and are in correct order
expect(
approvedInitialAndRenewalLabel.compareDocumentPosition(approvedInitialAndRenewalValue),
).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
});

test("TEMPORARY EXTENSION TYPE", async () => {
Expand Down

0 comments on commit fe19691

Please sign in to comment.