|
|
|
@ -15,6 +15,13 @@ vi.mock("@/translations/provider", () => ({ |
|
|
|
useI18n: vi.fn(() => ({ locale: "fa", dictionary: { Confirm: "تایید" } })), |
|
|
|
})); |
|
|
|
|
|
|
|
vi.mock("@/hooks/marriage/use-profile-main", () => ({ |
|
|
|
useMarriageProfileQuery: vi.fn(() => ({ |
|
|
|
data: { id: 1, can_edit_profile: true }, |
|
|
|
isLoading: false, |
|
|
|
})), |
|
|
|
})); |
|
|
|
|
|
|
|
vi.mock("@/hooks/marriage/use-section-data", () => ({ |
|
|
|
applyProfilePatchResultToCache: vi.fn(), |
|
|
|
useMarriageSectionDataQuery: vi.fn(() => ({ |
|
|
|
@ -91,16 +98,19 @@ describe("QuestionSheet component", () => { |
|
|
|
fireEvent.click(iranBtn); |
|
|
|
|
|
|
|
// Trigger should now show Iran
|
|
|
|
await waitFor(() => { |
|
|
|
expect(screen.getByText("ایران")).toBeDefined(); |
|
|
|
expect(document.body.classList.contains("dropdown-open")).toBe(false); |
|
|
|
expect(document.body.classList.contains("question-sheet-open")).toBe( |
|
|
|
false, |
|
|
|
); |
|
|
|
expect( |
|
|
|
(document.querySelector(".app-shell") as HTMLElement).style.overflowY, |
|
|
|
).toBe(""); |
|
|
|
}); |
|
|
|
await waitFor( |
|
|
|
() => { |
|
|
|
expect(screen.getByText("ایران")).toBeDefined(); |
|
|
|
expect(document.body.classList.contains("dropdown-open")).toBe(false); |
|
|
|
expect(document.body.classList.contains("question-sheet-open")).toBe( |
|
|
|
false, |
|
|
|
); |
|
|
|
expect( |
|
|
|
(document.querySelector(".app-shell") as HTMLElement).style.overflowY, |
|
|
|
).toBe(""); |
|
|
|
}, |
|
|
|
{ timeout: 1000 }, |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
it("supports multi-selection with confirm button", async () => { |
|
|
|
|