Files
familienarchiv/frontend/src/lib/document/TimelineYAxis.svelte.test.ts
Marcel acb52c3929 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-10 00:51:03 +02:00

30 lines
1.1 KiB
TypeScript

import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import TimelineYAxis from './TimelineYAxis.svelte';
afterEach(cleanup);
describe('TimelineYAxis', () => {
it('renders the maxCount and 0 labels', async () => {
render(TimelineYAxis, { props: { maxCount: 42, barAreaHeight: 100 } });
const axis = document.querySelector('[data-testid="timeline-y-axis"]') as HTMLElement;
expect(axis.textContent).toContain('42');
expect(axis.textContent).toContain('0');
});
it('applies the supplied barAreaHeight as inline style', async () => {
render(TimelineYAxis, { props: { maxCount: 10, barAreaHeight: 250 } });
const axis = document.querySelector('[data-testid="timeline-y-axis"]') as HTMLElement;
expect(axis.style.height).toBe('250px');
});
it('renders zero count without crashing', async () => {
render(TimelineYAxis, { props: { maxCount: 0, barAreaHeight: 100 } });
const axis = document.querySelector('[data-testid="timeline-y-axis"]') as HTMLElement;
expect(axis).not.toBeNull();
});
});