fix(documents): use i18n key for undated group label instead of hardcoded German string
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ const groups = $derived.by(() => {
|
|||||||
function groupByYear(docItems: DocumentSearchItem[]) {
|
function groupByYear(docItems: DocumentSearchItem[]) {
|
||||||
const map = new SvelteMap<string, DocumentSearchItem[]>();
|
const map = new SvelteMap<string, DocumentSearchItem[]>();
|
||||||
for (const item of docItems) {
|
for (const item of docItems) {
|
||||||
const label = item.document.documentDate?.substring(0, 4) ?? 'Ohne Datum';
|
const label = item.document.documentDate?.substring(0, 4) ?? m.docs_group_undated();
|
||||||
const bucket = map.get(label);
|
const bucket = map.get(label);
|
||||||
if (bucket) bucket.push(item);
|
if (bucket) bucket.push(item);
|
||||||
else map.set(label, [item]);
|
else map.set(label, [item]);
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ describe('DocumentList – year grouping', () => {
|
|||||||
await expect.element(groupCards.nth(1)).toBeInTheDocument();
|
await expect.element(groupCards.nth(1)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses Ohne Datum for items with no documentDate', async () => {
|
it('uses undated label for items with no documentDate', async () => {
|
||||||
const items = [
|
const items = [
|
||||||
makeItem({ document: { ...makeItem().document, id: '1', documentDate: undefined } })
|
makeItem({ document: { ...makeItem().document, id: '1', documentDate: undefined } })
|
||||||
];
|
];
|
||||||
render(DocumentList, { ...baseProps, items, total: 1 });
|
render(DocumentList, { ...baseProps, items, total: 1 });
|
||||||
await expect.element(page.getByText('Ohne Datum')).toBeInTheDocument();
|
await expect.element(page.getByText('Undatiert')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('single year renders one group-card', async () => {
|
it('single year renders one group-card', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user