Switch an entry status straight from the table

The list showed the status but only the editor could change it. Each row
now carries the next sensible step and names the blockers when publishing
is not possible. Also real umlauts in the API texts.
This commit is contained in:
Matthias G
2026-08-01 13:49:34 +02:00
parent c95db3a044
commit 35a572c037
6 changed files with 124 additions and 9 deletions
@@ -0,0 +1,34 @@
import { describe, expect, it, vi } from 'vitest'
import { renderToStaticMarkup } from 'react-dom/server'
import type { PostStatus } from '~/domain/types'
vi.mock('next-intl', () => ({
useTranslations: () => (key: string) => key,
}))
vi.mock('~/lib/entry-actions', () => ({
archiveEntry: vi.fn(),
publishEntry: vi.fn(),
resumeEntry: vi.fn(),
unscheduleEntry: vi.fn(),
}))
const { EntryStatusControl } = await import('~/components/admin/EntryStatusControl')
function render(status: PostStatus): string {
return renderToStaticMarkup(<EntryStatusControl id="e1f7f2f0-0000-4000-8000-000000000001" status={status} />)
}
describe('EntryStatusControl', () => {
it('bietet zu jedem Status den passenden Schritt an', () => {
expect(render('draft')).toContain('actions.publish')
expect(render('scheduled')).toContain('actions.unschedule')
expect(render('published')).toContain('actions.archive')
expect(render('archived')).toContain('actions.resume')
})
it('zeigt den Status immer als Marke', () => {
expect(render('draft')).toContain('status.draft')
expect(render('published')).toContain('status.published')
})
})