diff --git a/app/ui/groups/table.tsx b/app/ui/groups/table.tsx index d22909c..4b0bc60 100644 --- a/app/ui/groups/table.tsx +++ b/app/ui/groups/table.tsx @@ -21,7 +21,12 @@ export default function GroupsTable({ groups, onUpdate, onEdit, onEditAffinities const actions = (group: Group) => (
- { api.destroy(serializer, group, onUpdate) }} /> + { + if (window.confirm(`Are you sure you want to delete guest "${group.name}"?`)) { + api.destroy(serializer, group, onUpdate) + } + }} + /> onEdit(group)} /> onEditAffinities(group)} />
diff --git a/tests/groups.spec.ts b/tests/groups.spec.ts index 90297cb..a22cab4 100644 --- a/tests/groups.spec.ts +++ b/tests/groups.spec.ts @@ -52,6 +52,8 @@ test('should allow CRUD on groups', async ({ page }) => { await dialog.getByLabel('Name').fill("Pam's friends"); await dialog.getByRole('button', { name: 'Create' }).click(); + await expect(page.getByRole('row')).toHaveCount(4); // 1 header row + 3 data rows + await expect(dialog).not.toBeVisible(); await expect(page.getByRole('row').nth(1).getByRole('cell').nth(0)).toContainText('Pam\'s friends'); @@ -71,4 +73,10 @@ test('should allow CRUD on groups', async ({ page }) => { await dialog.getByRole('button', { name: 'Update' }).click(); await expect(page.getByRole('row').nth(1).getByRole('cell').nth(0)).toContainText('Pam\'s best friends'); + + // Delete the newly added group + page.on('dialog', dialog => dialog.accept()); + + await page.getByRole('row').nth(1).locator('svg').nth(1).click(); // Click delete icon + await expect(page.getByRole('row')).toHaveCount(3); // 1 header row + 2 data rows }); \ No newline at end of file