mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
test(frontend): wait for the picker's open focus before pressing Enter on the scope tab
The dialog moves focus to the search input on the next animation frame after opening. The test focused the sessions tab before that frame, so Enter sometimes landed on the search input and the scope never toggled. It now waits for the open focus, asserts the tab has focus, and checks the persisted scope.
This commit is contained in:
1 parent
adb251081f
commit
80e7f78a9b
1 file changed
+8
-2
@@ -357,12 +357,18 @@ describe('SessionPickerDialog', () => {
|
||||
const user = userEvent.setup()
|
||||
renderPicker()
|
||||
|
||||
await waitFor(() => expect(combobox()).toHaveFocus())
|
||||
|
||||
const sessionsTab = screen.getByRole('tab', { name: 'This project' })
|
||||
act(() => {
|
||||
screen.getByRole('tab', { name: 'This project' }).focus()
|
||||
sessionsTab.focus()
|
||||
})
|
||||
expect(sessionsTab).toHaveFocus()
|
||||
|
||||
await user.keyboard('{Enter}')
|
||||
|
||||
expect(screen.getByRole('tab', { name: 'All sessions', selected: true })).toBeInTheDocument()
|
||||
expect(await screen.findByRole('tab', { name: 'All sessions', selected: true })).toBeInTheDocument()
|
||||
expect(localStorage.getItem('oc:session-picker:all-projects')).toBe('true')
|
||||
})
|
||||
|
||||
it('labels the sessions tab Sessions and lists every project without a current repo', () => {
|
||||
|
||||
Reference in new issue
Block a user