test: fix dependency PR unit and visual checks

This commit is contained in:
cawestall 2026-09-23 01:00:34 -03:00
parent 0a45797d90
commit 49b6dda68d
4 changed files with 17 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 191 KiB

View file

@ -116,18 +116,32 @@ describe("VendorRosterFormFields address autocomplete", () => {
});
describe("VendorRosterFormFields map preview empty state", () => {
const INCOMPLETE_PLACEHOLDER_TEXT =
"Map preview appears once Street, City, and State are all filled.";
// MUI Autocomplete renders its own empty role="status" live region once the
// street combobox is interacted with, so the placeholder must be located by
// its SH-284 text among all status regions, never by any-status uniqueness.
function queryPlaceholderStatus(): HTMLElement | null {
return (
screen
.queryAllByRole("status")
.find((status) => status.textContent?.includes(INCOMPLETE_PLACEHOLDER_TEXT)) ?? null
);
}
it("shows the accessible placeholder while incomplete, then the map once complete", async () => {
const user = userEvent.setup();
renderWithProviders(<AddressFormHarness onValid={vi.fn()} />, { withAuth: false });
expect(screen.getByRole("status")).toHaveTextContent(/street, city, and state/i);
expect(queryPlaceholderStatus()).toBeInTheDocument();
expect(screen.queryByTitle(/^Map of /)).not.toBeInTheDocument();
await user.type(
screen.getByRole("combobox", { name: "Street Address (required)" }),
TYPED_STREET,
);
expect(screen.getByRole("status")).toBeInTheDocument();
expect(queryPlaceholderStatus()).toBeInTheDocument();
fireEvent.change(screen.getByRole("textbox", { name: "City (required)" }), {
target: { value: "Theodore" },
@ -135,6 +149,6 @@ describe("VendorRosterFormFields map preview empty state", () => {
pickVendorState("AL");
expect(await screen.findByTitle(`Map of ${TYPED_STREET} Theodore AL`)).toBeInTheDocument();
expect(screen.queryByRole("status")).not.toBeInTheDocument();
expect(queryPlaceholderStatus()).not.toBeInTheDocument();
});
});