feat(search): add year/group headers in document list when sorted by date, sender, or receiver #236
@@ -30,7 +30,9 @@ let {
|
||||
sort?: string;
|
||||
} = $props();
|
||||
|
||||
const fallbackLabel = $derived(sort === 'DATE' ? m.docs_group_undated() : m.docs_group_unknown());
|
||||
const fallbackLabel = $derived(
|
||||
(sort ?? 'DATE') === 'DATE' ? m.docs_group_undated() : m.docs_group_unknown()
|
||||
);
|
||||
const groupedDocuments = $derived.by(() =>
|
||||
groupDocuments(documents, sort ?? 'DATE', fallbackLabel)
|
||||
);
|
||||
|
||||
@@ -90,6 +90,15 @@ describe('DocumentList – group headers', () => {
|
||||
await expect.element(page.getByTestId('group-divider')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows Undatiert fallback label when sort is undefined and doc has no date', async () => {
|
||||
const documents = [
|
||||
makeDoc({ id: '1', documentDate: '1938-01-01' }),
|
||||
makeDoc({ id: '2', documentDate: null })
|
||||
];
|
||||
render(DocumentList, { ...baseProps, documents, total: 2 }); // sort omitted — defaults to DATE grouping
|
||||
await expect.element(page.getByText(/UNDATIERT/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('a doc with two receivers appears in both receiver groups', async () => {
|
||||
const documents = [
|
||||
makeDoc({
|
||||
|
||||
Reference in New Issue
Block a user