test(frontend): task dialog, sharing avatars, trash, API key scopes, passwords (FLAW-19)
Covers opening and closing the task dialog (the former hook-order bug), date/time fields and the view-only mode for viewer lists, the avatar stack of shared items, the two-tap delete in the trash, scope selection and badges of API keys, and the shared password rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c50d15915
commit
0fdf46635b
5 files changed
+174
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, fireEvent, act } from '@testing-library/react';
|
||||
import { TrashView } from '../TrashView';
|
||||
|
||||
const items = [
|
||||
{ id: 'doc_1', title: 'Urlaub', icon: '🏔️', folderPath: 'Privat', deletedAt: '2026-10-29T08:00:00Z', isOwner: true },
|
||||
];
|
||||
|
||||
describe('TrashView', () => {
|
||||
it('deletes for good only on the second tap', async () => {
|
||||
const onPurge = vi.fn(async () => {});
|
||||
render(<TrashView items={items} onOpen={vi.fn()} onRestore={vi.fn(async () => {})} onPurge={onPurge} onEmpty={vi.fn(async () => {})} onBackMobile={vi.fn()} />);
|
||||
fireEvent.click(screen.getByText('Endgültig löschen'));
|
||||
expect(onPurge).not.toHaveBeenCalled();
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByText('Wirklich löschen?'));
|
||||
});
|
||||
expect(onPurge).toHaveBeenCalledWith('doc_1');
|
||||
});
|
||||
|
||||
it('restores with one tap and shows the original folder', async () => {
|
||||
const onRestore = vi.fn(async () => {});
|
||||
render(<TrashView items={items} onOpen={vi.fn()} onRestore={onRestore} onPurge={vi.fn(async () => {})} onEmpty={vi.fn(async () => {})} onBackMobile={vi.fn()} />);
|
||||
expect(screen.getByText('Privat')).toBeTruthy();
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByText('Wiederherstellen'));
|
||||
});
|
||||
expect(onRestore).toHaveBeenCalledWith('doc_1');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user