refactor(documents): rename year-card testid to group-card
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,7 @@ function groupByReceiver(docItems: DocumentSearchItem[]) {
|
|||||||
<!-- GROUP CARDS -->
|
<!-- GROUP CARDS -->
|
||||||
{#each groups as group (group.label)}
|
{#each groups as group (group.label)}
|
||||||
<div
|
<div
|
||||||
data-testid="year-card"
|
data-testid="group-card"
|
||||||
class="mb-4 overflow-hidden border border-line bg-surface shadow-sm"
|
class="mb-4 overflow-hidden border border-line bg-surface shadow-sm"
|
||||||
>
|
>
|
||||||
<div class="border-b border-line bg-muted px-5 py-2">
|
<div class="border-b border-line bg-muted px-5 py-2">
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ describe('DocumentList – year grouping', () => {
|
|||||||
makeItem({ document: { ...makeItem().document, id: '2', documentDate: '1965-08-03' } })
|
makeItem({ document: { ...makeItem().document, id: '2', documentDate: '1965-08-03' } })
|
||||||
];
|
];
|
||||||
render(DocumentList, { ...baseProps, items, total: 2 });
|
render(DocumentList, { ...baseProps, items, total: 2 });
|
||||||
const yearCards = page.getByTestId('year-card');
|
const groupCards = page.getByTestId('group-card');
|
||||||
await expect.element(yearCards.first()).toBeInTheDocument();
|
await expect.element(groupCards.first()).toBeInTheDocument();
|
||||||
await expect.element(yearCards.nth(1)).toBeInTheDocument();
|
await expect.element(groupCards.nth(1)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses Ohne Datum for items with no documentDate', async () => {
|
it('uses Ohne Datum for items with no documentDate', async () => {
|
||||||
@@ -92,16 +92,15 @@ describe('DocumentList – year grouping', () => {
|
|||||||
await expect.element(page.getByText('Ohne Datum')).toBeInTheDocument();
|
await expect.element(page.getByText('Ohne Datum')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('single year renders one year-card', async () => {
|
it('single year renders one group-card', async () => {
|
||||||
const items = [
|
const items = [
|
||||||
makeItem({ document: { ...makeItem().document, id: '1', documentDate: '1938-01-01' } }),
|
makeItem({ document: { ...makeItem().document, id: '1', documentDate: '1938-01-01' } }),
|
||||||
makeItem({ document: { ...makeItem().document, id: '2', documentDate: '1938-06-15' } })
|
makeItem({ document: { ...makeItem().document, id: '2', documentDate: '1938-06-15' } })
|
||||||
];
|
];
|
||||||
render(DocumentList, { ...baseProps, items, total: 2 });
|
render(DocumentList, { ...baseProps, items, total: 2 });
|
||||||
const yearCards = page.getByTestId('year-card');
|
const groupCards = page.getByTestId('group-card');
|
||||||
// Only one card for 1938
|
await expect.element(groupCards.first()).toBeInTheDocument();
|
||||||
await expect.element(yearCards.first()).toBeInTheDocument();
|
await expect.element(groupCards.nth(1)).not.toBeInTheDocument();
|
||||||
await expect.element(yearCards.nth(1)).not.toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -156,7 +155,7 @@ describe('DocumentList – sender grouping', () => {
|
|||||||
makeItem({ document: { ...makeItem().document, id: '2', sender } })
|
makeItem({ document: { ...makeItem().document, id: '2', sender } })
|
||||||
];
|
];
|
||||||
render(DocumentList, { ...baseProps, items, total: 2, sort: 'SENDER' });
|
render(DocumentList, { ...baseProps, items, total: 2, sort: 'SENDER' });
|
||||||
const cards = page.getByTestId('year-card');
|
const cards = page.getByTestId('group-card');
|
||||||
await expect.element(cards.first()).toBeInTheDocument();
|
await expect.element(cards.first()).toBeInTheDocument();
|
||||||
await expect.element(cards.nth(1)).not.toBeInTheDocument();
|
await expect.element(cards.nth(1)).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
@@ -210,7 +209,7 @@ describe('DocumentList – receiver grouping', () => {
|
|||||||
await expect
|
await expect
|
||||||
.element(page.getByTestId('group-header').filter({ hasText: 'Hans Meier' }))
|
.element(page.getByTestId('group-header').filter({ hasText: 'Hans Meier' }))
|
||||||
.toBeInTheDocument();
|
.toBeInTheDocument();
|
||||||
const cards = page.getByTestId('year-card');
|
const cards = page.getByTestId('group-card');
|
||||||
await expect.element(cards.nth(1)).toBeInTheDocument();
|
await expect.element(cards.nth(1)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user