Moves ~25 components, utils (search, filename, groupDocuments, documentStatusLabel, validateFile), bulkSelection store, and TranscriptionSection sub-component. Fixes broken relative imports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
2.5 KiB
TypeScript
58 lines
2.5 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest';
|
|
import { cleanup, render } from 'vitest-browser-svelte';
|
|
import DescriptionSection from './DescriptionSection.svelte';
|
|
|
|
afterEach(() => cleanup());
|
|
|
|
describe('DescriptionSection — onMount seeding (Felix B1/B2 fix regression fence)', () => {
|
|
it('pre-fills the title input from initialTitle when currentTitle is empty', async () => {
|
|
render(DescriptionSection, { initialTitle: 'Brief an Anna' });
|
|
const titleInput = document.querySelector('input#title') as HTMLInputElement;
|
|
expect(titleInput).not.toBeNull();
|
|
expect(titleInput.value).toBe('Brief an Anna');
|
|
});
|
|
|
|
it('does not stomp a parent-bound currentTitle that is already non-empty', async () => {
|
|
render(DescriptionSection, {
|
|
currentTitle: 'Parent Title',
|
|
initialTitle: 'Should Not Win'
|
|
});
|
|
const titleInput = document.querySelector('input#title') as HTMLInputElement;
|
|
expect(titleInput.value).toBe('Parent Title');
|
|
});
|
|
|
|
it('always renders archiveBox + archiveFolder fields regardless of editMode', async () => {
|
|
render(DescriptionSection, { editMode: false });
|
|
expect(document.querySelector('[data-testid="description-archive-box"]')).not.toBeNull();
|
|
expect(document.querySelector('[data-testid="description-archive-folder"]')).not.toBeNull();
|
|
});
|
|
|
|
it('renders the editMode-only archiveBox + archiveFolder fields when editMode=true', async () => {
|
|
render(DescriptionSection, { editMode: true, hideTitle: true });
|
|
expect(document.querySelector('[data-testid="description-archive-box"]')).not.toBeNull();
|
|
expect(document.querySelector('[data-testid="description-archive-folder"]')).not.toBeNull();
|
|
});
|
|
|
|
it('pre-fills archiveBox from initialArchiveBox when archiveBox is empty', async () => {
|
|
render(DescriptionSection, { initialArchiveBox: 'K-03', hideTitle: true });
|
|
const input = document.querySelector('input#archiveBox') as HTMLInputElement;
|
|
expect(input.value).toBe('K-03');
|
|
});
|
|
|
|
it('pre-fills archiveFolder from initialArchiveFolder when archiveFolder is empty', async () => {
|
|
render(DescriptionSection, { initialArchiveFolder: 'Mappe B', hideTitle: true });
|
|
const input = document.querySelector('input#archiveFolder') as HTMLInputElement;
|
|
expect(input.value).toBe('Mappe B');
|
|
});
|
|
|
|
it('does not stomp a parent-bound archiveBox that is already non-empty', async () => {
|
|
render(DescriptionSection, {
|
|
archiveBox: 'Parent Value',
|
|
initialArchiveBox: 'Should Not Win',
|
|
hideTitle: true
|
|
});
|
|
const input = document.querySelector('input#archiveBox') as HTMLInputElement;
|
|
expect(input.value).toBe('Parent Value');
|
|
});
|
|
});
|