From 78a13c02b02a7c2d53e8b0a9a119c9e39027b549 Mon Sep 17 00:00:00 2001 From: waleed Date: Mon, 6 Jul 2026 23:51:43 -0700 Subject: [PATCH] test(user-input): assert dismissed mention stays closed across repeated clicks Follow-up to #5464: strengthens the click-away regression test to click the same position three times after a dismiss, not just once, proving the suppression holds for the exact reported repro (repeatedly clicking the same trailing spot) rather than just a single follow-up click. --- .../prompt-editor/use-prompt-editor.test.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx index 7cd9a2281c0..4a8696a0f15 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx @@ -116,7 +116,7 @@ describe('usePromptEditor mention menu dismissal', () => { unmount() }) - it('does not reopen after the user clicks away, even if the caret lands back inside the open mention', () => { + it('stays closed across repeated clicks at the same position after the user clicks away, even if the caret lands back inside the open mention', () => { const { result, textarea, unmount } = renderPromptEditor({ workspaceId: 'ws-1' }) result().plusMenuRef.current = openMenu @@ -134,10 +134,12 @@ describe('usePromptEditor mention menu dismissal', () => { }) expect(result().mentionQuery).toBeNull() - act(() => { - textarea.setSelectionRange(2, 2) - result().handleSelectAdjust() - }) + for (let i = 0; i < 3; i++) { + act(() => { + textarea.setSelectionRange(2, 2) + result().handleSelectAdjust() + }) + } expect(result().mentionQuery).toBeNull() expect(openMenu.open).toHaveBeenCalledTimes(1)