mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
test(user-input): assert dismissed mention stays closed across repeated clicks (#5466)
This commit is contained in:
+7
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user