Add specs when group is deleted (+ add confirmation dialog)
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m9s
Add copyright notice / copyright_notice (pull_request) Successful in 1m33s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m29s
Playwright Tests / test (pull_request) Successful in 4m40s
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m9s
Add copyright notice / copyright_notice (pull_request) Successful in 1m33s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m29s
Playwright Tests / test (pull_request) Successful in 4m40s
This commit is contained in:
parent
1b957879d4
commit
bcc86f2c3b
@ -21,7 +21,12 @@ export default function GroupsTable({ groups, onUpdate, onEdit, onEditAffinities
|
|||||||
|
|
||||||
const actions = (group: Group) => (
|
const actions = (group: Group) => (
|
||||||
<div className="flex flex-row items-center">
|
<div className="flex flex-row items-center">
|
||||||
<TrashIcon className='size-6 cursor-pointer' onClick={() => { api.destroy(serializer, group, onUpdate) }} />
|
<TrashIcon className='size-6 cursor-pointer' onClick={() => {
|
||||||
|
if (window.confirm(`Are you sure you want to delete guest "${group.name}"?`)) {
|
||||||
|
api.destroy(serializer, group, onUpdate)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<PencilIcon className='size-6 cursor-pointer' onClick={() => onEdit(group)} />
|
<PencilIcon className='size-6 cursor-pointer' onClick={() => onEdit(group)} />
|
||||||
<AdjustmentsHorizontalIcon className='size-6 cursor-pointer' onClick={() => onEditAffinities(group)} />
|
<AdjustmentsHorizontalIcon className='size-6 cursor-pointer' onClick={() => onEditAffinities(group)} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,6 +52,8 @@ test('should allow CRUD on groups', async ({ page }) => {
|
|||||||
await dialog.getByLabel('Name').fill("Pam's friends");
|
await dialog.getByLabel('Name').fill("Pam's friends");
|
||||||
await dialog.getByRole('button', { name: 'Create' }).click();
|
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(dialog).not.toBeVisible();
|
||||||
|
|
||||||
await expect(page.getByRole('row').nth(1).getByRole('cell').nth(0)).toContainText('Pam\'s friends');
|
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 dialog.getByRole('button', { name: 'Update' }).click();
|
||||||
|
|
||||||
await expect(page.getByRole('row').nth(1).getByRole('cell').nth(0)).toContainText('Pam\'s best friends');
|
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
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user