Skip to content

Commit 3ddf254

Browse files
authored
test(user-input): assert dismissed mention stays closed across repeated clicks (#5466)
1 parent cad44b9 commit 3ddf254

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('usePromptEditor mention menu dismissal', () => {
116116
unmount()
117117
})
118118

119-
it('does not reopen after the user clicks away, even if the caret lands back inside the open mention', () => {
119+
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', () => {
120120
const { result, textarea, unmount } = renderPromptEditor({ workspaceId: 'ws-1' })
121121
result().plusMenuRef.current = openMenu
122122

@@ -134,10 +134,12 @@ describe('usePromptEditor mention menu dismissal', () => {
134134
})
135135
expect(result().mentionQuery).toBeNull()
136136

137-
act(() => {
138-
textarea.setSelectionRange(2, 2)
139-
result().handleSelectAdjust()
140-
})
137+
for (let i = 0; i < 3; i++) {
138+
act(() => {
139+
textarea.setSelectionRange(2, 2)
140+
result().handleSelectAdjust()
141+
})
142+
}
141143

142144
expect(result().mentionQuery).toBeNull()
143145
expect(openMenu.open).toHaveBeenCalledTimes(1)

0 commit comments

Comments
 (0)