This was an update of which I cannot remember what it did but it was surely something that I needed so let's commit it. YOLO
CI / check (push) Waiting to run

This commit is contained in:
2026-09-22 16:38:00 +02:00
parent dbb7e40c6c
commit 5112d3de94
13 changed files with 172 additions and 55 deletions
+23 -3
View File
@@ -10,6 +10,7 @@ vi.mock('../src/renderer/src/terminals', () => {
import { App } from '../src/renderer/src/App'
import { ProjectProvider } from '../src/renderer/src/project'
import { normalizeCommitMsg } from '../src/renderer/src/components'
beforeAll(() => {
globalThis.ResizeObserver = class { observe() {} unobserve() {} disconnect() {} } as never
@@ -78,7 +79,7 @@ describe('Pass on to Agent', () => {
})
describe('Stage + commit', () => {
it('stages a file and commits via Shift+Enter (no commit button)', async () => {
it('stages a file and commits via Shift+Enter', async () => {
const c = renderApp()
const row = await waitFor(() => {
const r = find(c, '.git-row', 'UserController.php')
@@ -86,13 +87,26 @@ describe('Stage + commit', () => {
return r
})
fireEvent.click(row.querySelector<HTMLButtonElement>('button[title="Stage changes"]')!)
// the commit button is intentionally gone — committing is keyboard-only
expect(c.querySelector('.commit-btn')).toBeNull()
const msg = c.querySelector<HTMLTextAreaElement>('.commit-input')!
fireEvent.change(msg, { target: { value: 'wire up balance' } })
fireEvent.keyDown(msg, { key: 'Enter', shiftKey: true })
await waitFor(() => expect(find(c, '.toast', 'Committed')).toBeTruthy())
})
it('commits from the button once a file is staged', async () => {
const c = renderApp()
const row = await waitFor(() => {
const r = find(c, '.git-row', 'UserController.php')
if (!r) throw new Error('git not ready')
return r
})
fireEvent.click(row.querySelector<HTMLButtonElement>('button[title="Stage changes"]')!)
await waitFor(() => expect(c.querySelector<HTMLButtonElement>('.commit-btn')!.disabled).toBe(false))
const msg = c.querySelector<HTMLTextAreaElement>('.commit-input')!
fireEvent.change(msg, { target: { value: 'wire up balance' } })
fireEvent.click(c.querySelector<HTMLButtonElement>('.commit-btn')!)
await waitFor(() => expect(find(c, '.toast', 'Committed')).toBeTruthy())
})
})
describe('Explorer background menu', () => {
@@ -126,3 +140,9 @@ describe('Explorer background menu', () => {
expect(find(c, '.ctx-item', 'Copy file name')).toBeTruthy()
})
})
describe('Commit message normalization', () => {
it('lowercases the text and folds the line breaks into one line', () => {
expect(normalizeCommitMsg('Fix Login\nAnd Logout\r\n Flow')).toBe('fix login and logout flow')
})
})