diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx
index 71af78a..bbee811 100644
--- a/app/ui/guests/table.tsx
+++ b/app/ui/guests/table.tsx
@@ -3,7 +3,7 @@
'use client';
import { AbstractApi } from '@/app/api/abstract-api';
-import { Guest , GuestSerializer} from '@/app/lib/guest';
+import { Guest, GuestSerializer } from '@/app/lib/guest';
import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx';
import TableOfContents from '../components/table-of-contents';
@@ -48,7 +48,12 @@ export default function guestsTable({ guests, onUpdate, onEdit }: {
- { api.destroy(serializer, guest, onUpdate)}} />
+ {
+ if (window.confirm(`Are you sure you want to delete guest "${guest.name}"?`)) {
+ api.destroy(serializer, guest, onUpdate)
+ }
+ }}
+ />
onEdit(guest)} />
|
diff --git a/tests/guests.spec.ts b/tests/guests.spec.ts
index 7416c09..45bb322 100644
--- a/tests/guests.spec.ts
+++ b/tests/guests.spec.ts
@@ -70,6 +70,7 @@ test('should allow CRUD on guests', async ({ page }) => {
await expect(page.getByText('There are 3 elements in the list')).toBeVisible();
// Delete John Fire
+ page.on('dialog', dialog => dialog.accept());
await page.getByRole('row').nth(1).locator('svg').nth(0).click(); // Click delete icon
await expect(page.getByText('There are 2 elements in the list')).toBeVisible();
});