This commit is contained in:
Victor Santos
2025-07-07 16:53:57 -03:00
parent cb4efa2334
commit 423f149208

View File

@@ -245,13 +245,17 @@ describe("EndScreenForm", () => {
const buttonLinkInput = container.querySelector("#buttonLink") as HTMLInputElement;
expect(buttonLinkInput).toBeTruthy();
// Mock focus method
const mockFocus = vi.fn();
if (buttonLinkInput) {
buttonLinkInput.focus = mockFocus;
// Use vi.spyOn to properly mock the focus method
const focusSpy = vi.spyOn(buttonLinkInput, "focus");
// Call focus to simulate the behavior
buttonLinkInput.focus();
expect(mockFocus).toHaveBeenCalled();
expect(focusSpy).toHaveBeenCalled();
// Clean up the spy
focusSpy.mockRestore();
}
});