GeschichteSidebar gains optional geschichteId/items props and renders the panel only when geschichteId is set. GeschichteEditor derives both from its existing GeschichteView prop — null on /geschichten/new, so the panel stays hidden there (create-then-edit, same as journeys). JourneyEditor's sidebar call site is untouched, so journeys never show the panel. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest';
|
|
import { cleanup, render } from 'vitest-browser-svelte';
|
|
import { page } from 'vitest/browser';
|
|
import { m } from '$lib/paraglide/messages.js';
|
|
import GeschichteSidebar from './GeschichteSidebar.svelte';
|
|
|
|
const item = {
|
|
id: 'i1',
|
|
position: 10,
|
|
document: {
|
|
id: 'd1',
|
|
title: 'Brief von Eugenie',
|
|
datePrecision: 'DAY' as const,
|
|
receiverCount: 0
|
|
}
|
|
};
|
|
|
|
afterEach(() => cleanup());
|
|
|
|
describe('GeschichteSidebar — document panel contract (#795)', () => {
|
|
it('renders the document panel when geschichteId and items are provided', async () => {
|
|
render(GeschichteSidebar, {
|
|
status: 'DRAFT',
|
|
selectedPersons: [],
|
|
geschichteId: 'g1',
|
|
items: [item]
|
|
});
|
|
|
|
await expect
|
|
.element(page.getByRole('heading', { name: m.geschichte_documents_heading() }))
|
|
.toBeInTheDocument();
|
|
await expect.element(page.getByText('Brief von Eugenie')).toBeInTheDocument();
|
|
});
|
|
|
|
it('does not render the document panel without geschichteId', async () => {
|
|
render(GeschichteSidebar, { status: 'DRAFT', selectedPersons: [] });
|
|
|
|
expect(document.body.textContent).not.toContain(m.geschichte_documents_heading());
|
|
});
|
|
});
|