Files
familienarchiv/frontend/src/lib/document/transcription/TranscriptionSection.svelte.test.ts
Marcel fbff5d9bd2 test: cover four small primitives
RelationshipPill: label render, empty-string handling.
OverflowPillDisplay: +N rendering, +0 edge case, aria-hidden marker.
TimelineYAxis: max/0 labels, barAreaHeight inline style, zero handling.
TranscriptionSection: heading + textarea, initial-value hydration,
empty default.

11 tests across four small primitives.

Refs #496.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 21:50:28 +02:00

37 lines
1.2 KiB
TypeScript

import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import TranscriptionSection from './TranscriptionSection.svelte';
afterEach(cleanup);
describe('TranscriptionSection', () => {
it('renders the section heading and textarea', async () => {
render(TranscriptionSection, { props: {} });
await expect.element(page.getByRole('heading', { name: /transkription/i })).toBeVisible();
const textarea = document.querySelector(
'textarea[name="transcription"]'
) as HTMLTextAreaElement;
expect(textarea).not.toBeNull();
});
it('hydrates the textarea with the initial transcription value', async () => {
render(TranscriptionSection, { props: { initialTranscription: 'Hello World' } });
const textarea = document.querySelector(
'textarea[name="transcription"]'
) as HTMLTextAreaElement;
expect(textarea.value).toBe('Hello World');
});
it('renders an empty textarea by default', async () => {
render(TranscriptionSection, { props: {} });
const textarea = document.querySelector(
'textarea[name="transcription"]'
) as HTMLTextAreaElement;
expect(textarea.value).toBe('');
});
});