mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(sessions): render picker views inside matching tab panels
This commit is contained in:
1 parent
c41eff304c
commit
1270e4b52e
2 files changed
+25
-4
No files matched your search
@@ -500,6 +500,20 @@ describe('SessionPickerDialog', () => {
|
||||
expect(combobox()).toHaveAttribute('placeholder', 'Search sessions...')
|
||||
})
|
||||
|
||||
it('exposes a tabpanel labelled by the active tab and swaps panels on tab switch', async () => {
|
||||
renderPicker()
|
||||
|
||||
const sessionsPanel = screen.getByRole('tabpanel', { name: 'Sessions' })
|
||||
expect(sessionsPanel).toHaveAttribute('data-state', 'active')
|
||||
expect(screen.queryByRole('tabpanel', { name: 'Projects' })).not.toBeInTheDocument()
|
||||
|
||||
openProjectsTab()
|
||||
|
||||
const projectsPanel = await screen.findByRole('tabpanel', { name: 'Projects' })
|
||||
expect(projectsPanel).toHaveAttribute('data-state', 'active')
|
||||
expect(screen.queryByRole('tabpanel', { name: 'Sessions' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('lists repos in the projects tab and opens the cursor repo on Enter', async () => {
|
||||
mocks.repos = [repo(1, 'alpha', '/w/a'), repo(2, 'beta', '/w/b')]
|
||||
const { onSelectRepo } = renderPicker()
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { SessionStatusIndicator } from '@/components/ui/session-status-indicator'
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { DeleteSessionDialog } from '@/components/session/DeleteSessionDialog'
|
||||
import { ProjectPickerContent } from '@/components/session/ProjectPickerContent'
|
||||
import { partitionSessions } from '@/components/session/session-partition'
|
||||
@@ -765,7 +765,10 @@ export function SessionPickerDialog({
|
||||
<TabsTrigger value="projects">Projects</TabsTrigger>
|
||||
</TabsList>
|
||||
</div>
|
||||
{tab === 'sessions' ? (
|
||||
<TabsContent
|
||||
value="sessions"
|
||||
className="mt-0 flex min-h-0 w-full min-w-0 flex-1 flex-col px-0"
|
||||
>
|
||||
<SessionPickerContent
|
||||
open={open}
|
||||
currentRepo={currentRepo}
|
||||
@@ -776,7 +779,11 @@ export function SessionPickerDialog({
|
||||
searchInputRef={searchInputRef}
|
||||
hasFinePointer={hasFinePointer}
|
||||
/>
|
||||
) : (
|
||||
</TabsContent>
|
||||
<TabsContent
|
||||
value="projects"
|
||||
className="mt-0 flex min-h-0 w-full min-w-0 flex-1 flex-col px-0"
|
||||
>
|
||||
<ProjectPickerContent
|
||||
open={open}
|
||||
currentRepo={currentRepo}
|
||||
@@ -784,7 +791,7 @@ export function SessionPickerDialog({
|
||||
switchHint={switchHint}
|
||||
searchInputRef={projectSearchInputRef}
|
||||
/>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user