test: update modal tests to reflect global ESC handler
Remove ESC-keydown tests from ProfileModal.test.tsx since the useEscapeKey hook was removed from individual modals. Escape key handling is now centralized in App.tsx's global handler, making per-component ESC tests invalid (the component no longer responds to ESC in isolation).
This commit is contained in:
@@ -66,27 +66,7 @@ describe("ProfileModal", () => {
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls onClose when Escape is pressed on overlay", () => {
|
||||
const onClose = vi.fn();
|
||||
render(<ProfileModal isOpen={true} onClose={onClose} />);
|
||||
|
||||
const overlay = document.querySelector(".modal-overlay");
|
||||
if (overlay) {
|
||||
fireEvent.keyDown(overlay, { key: "Escape" });
|
||||
}
|
||||
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not close on non-escape keydown", () => {
|
||||
const onClose = vi.fn();
|
||||
render(<ProfileModal isOpen={true} onClose={onClose} />);
|
||||
|
||||
const overlay = document.querySelector(".modal-overlay");
|
||||
if (overlay) {
|
||||
fireEvent.keyDown(overlay, { key: "Enter" });
|
||||
}
|
||||
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
});
|
||||
// ESC key handling is tested at the App level — the global handler in
|
||||
// App.tsx manages Escape for all modals, so per-component ESC tests are
|
||||
// not applicable here.
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user