mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: make focus grabbing test more robust by waiting for debounce effects
This commit is contained in:
parent
07f30b8004
commit
374434f85d
1 changed files with 12 additions and 1 deletions
|
|
@ -468,7 +468,12 @@ describe("ChatView - Focus Grabbing Tests", () => {
|
|||
expect(getByTestId("chat-textarea")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
// Clear any initial calls after state has settled
|
||||
// Wait for debounced focus effect to settle (useDebounceEffect has 50ms delay)
|
||||
await act(async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
})
|
||||
|
||||
// Clear any initial calls after state and debounce effects have settled
|
||||
mockFocus.mockClear()
|
||||
|
||||
// Add follow-up question
|
||||
|
|
@ -494,7 +499,13 @@ describe("ChatView - Focus Grabbing Tests", () => {
|
|||
expect(getByTestId("chat-textarea")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
// Wait for any debounced effects to settle after the follow-up message
|
||||
await act(async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
})
|
||||
|
||||
// Should not grab focus for follow-up questions
|
||||
// (enableButtons is set to true for followup to prevent focus grab)
|
||||
expect(mockFocus).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue