feat(source-control): edge-anchored sidebar toggle, branches header cleanup, orange current-branch accents (#349)

* feat(source-control): edge-anchored sidebar toggle, branches header cleanup, orange current-branch accents

* feat(settings): sidebar navigation with per-tab two-column layouts and mobile menu landing

* fix(ui): re-measure prompt overlay after edit remount and anchor mobile stop button above input
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-09 10:57:35 -04:00
1 parent 47d57df628
commit 16f9f9c2ee
28 files changed
+1777 -918

No files matched your search

@@ -0,0 +1,52 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { render, screen, fireEvent, within } from '@testing-library/react'
import { KeyboardShortcuts } from './KeyboardShortcuts'
import { DEFAULT_KEYBOARD_SHORTCUTS } from '@/api/types/settings'
const { updateSettings } = vi.hoisted(() => ({ updateSettings: vi.fn() }))
vi.mock('@/hooks/useMobile', () => ({ useMobile: () => false }))
vi.mock('@/hooks/useSettings', () => ({
useSettings: () => ({
preferences: { keyboardShortcuts: { customAction: 'Alt+J' } },
isLoading: false,
updateSettings,
}),
}))
describe('KeyboardShortcuts layout', () => {
beforeEach(() => vi.clearAllMocks())
it('groups every default and custom action exactly once', () => {
render(<KeyboardShortcuts />)
expect(screen.getByRole('region', { name: 'Conversation actions' })).toBeInTheDocument()
const navigation = screen.getByRole('region', { name: 'Navigation' })
for (const action of [...Object.keys(DEFAULT_KEYBOARD_SHORTCUTS), 'customAction']) {
expect(screen.getAllByText(action.replace(/([A-Z])/g, ' $1').trim(), { exact: true })).toHaveLength(1)
}
expect(within(navigation).getByText('custom Action')).toBeInTheDocument()
})
it('keeps recording focused through modifier updates and saves the selected action', () => {
render(<KeyboardShortcuts />)
fireEvent.click(screen.getByRole('button', { name: /Alt\+J/ }))
const input = screen.getByPlaceholderText('Press keys...')
expect(input).toHaveFocus()
fireEvent.keyDown(input, { key: 'Control', ctrlKey: true })
expect(screen.getByPlaceholderText('Press keys...')).toBe(input)
expect(input).toHaveFocus()
fireEvent.keyDown(input, { key: 'k', ctrlKey: true })
expect(updateSettings).toHaveBeenCalledWith({ keyboardShortcuts: expect.objectContaining({ customAction: 'Ctrl+K' }) })
expect(screen.queryByPlaceholderText('Press keys...')).not.toBeInTheDocument()
})
it('preserves direct-toggle and clear actions in a grouped row', () => {
render(<KeyboardShortcuts />)
const row = screen.getByText('custom Action').parentElement!.parentElement!
fireEvent.click(within(row).getByRole('button', { name: 'Requires leader key (click to make direct)' }))
expect(updateSettings).toHaveBeenCalledWith({ directShortcuts: ['submit', 'abort', 'customAction'] })
fireEvent.click(within(row).getByTitle('Clear shortcut'))
expect(updateSettings).toHaveBeenCalledWith({ keyboardShortcuts: expect.objectContaining({ customAction: '' }) })
expect(within(row).getByRole('button', { name: 'Not set' })).toBeInTheDocument()
})
})