Skip to content

Commit

Permalink
test: add regression test
Browse files Browse the repository at this point in the history
Signed-off-by: SeSo <sobhani.sepehr@gmail.com>
  • Loading branch information
Sepehr-Sobhani committed Jan 7, 2025
1 parent 653e36e commit f24d49f
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,29 @@ describe("ContactForm component", () => {
},
);
});
it("renders the places assigned field in read-only mode when editing", async () => {
const readOnlyContactSchema = createContactSchema(
contactsSchema,
[],
false,
);
render(
<ContactForm
schema={readOnlyContactSchema}
uiSchema={contactsUiSchema}
formData={contactFormData}
allowEdit
/>,
);
// switch to edit mode
await userEvent.click(screen.getByRole("button", { name: /edit/i }));

// regression test: places assigned field should not be editable
expect(
screen.queryByDisplayValue(/operation representative \- operation 1/i),
).not.toBeInTheDocument();
expect(
screen.queryByRole("button", { name: /remove item/i }),
).not.toBeInTheDocument();
});
});

0 comments on commit f24d49f

Please sign in to comment.