mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
test: fix dependency PR unit and visual checks
This commit is contained in:
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 |
|
|
@ -116,18 +116,32 @@ describe("VendorRosterFormFields address autocomplete", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("VendorRosterFormFields map preview empty state", () => {
|
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 () => {
|
it("shows the accessible placeholder while incomplete, then the map once complete", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
renderWithProviders(<AddressFormHarness onValid={vi.fn()} />, { withAuth: false });
|
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();
|
expect(screen.queryByTitle(/^Map of /)).not.toBeInTheDocument();
|
||||||
|
|
||||||
await user.type(
|
await user.type(
|
||||||
screen.getByRole("combobox", { name: "Street Address (required)" }),
|
screen.getByRole("combobox", { name: "Street Address (required)" }),
|
||||||
TYPED_STREET,
|
TYPED_STREET,
|
||||||
);
|
);
|
||||||
expect(screen.getByRole("status")).toBeInTheDocument();
|
expect(queryPlaceholderStatus()).toBeInTheDocument();
|
||||||
|
|
||||||
fireEvent.change(screen.getByRole("textbox", { name: "City (required)" }), {
|
fireEvent.change(screen.getByRole("textbox", { name: "City (required)" }), {
|
||||||
target: { value: "Theodore" },
|
target: { value: "Theodore" },
|
||||||
|
|
@ -135,6 +149,6 @@ describe("VendorRosterFormFields map preview empty state", () => {
|
||||||
pickVendorState("AL");
|
pickVendorState("AL");
|
||||||
|
|
||||||
expect(await screen.findByTitle(`Map of ${TYPED_STREET} Theodore AL`)).toBeInTheDocument();
|
expect(await screen.findByTitle(`Map of ${TYPED_STREET} Theodore AL`)).toBeInTheDocument();
|
||||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
expect(queryPlaceholderStatus()).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue