feat(workspace): deleted folders go to the trash as a whole, after a confirmation
A deleted personal folder is kept in trashed_folders with its subfolders; its notes are trashed and tied to it. The trash lists the folder as one entry with its note count; restoring brings back the folder tree (empty subfolders too) and all notes, deleting for good, emptying the trash and the notes trash delay remove it with its notes. Folders in shared folders keep the old way. Deleting a folder now asks first, in a small popover at the click (ConfirmPopover, documented in ui-patterns). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9dcfa6c27e
commit
b26b07cfea
18 files changed
+564
-25
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { ConfirmPopover } from '../ConfirmPopover';
|
||||
|
||||
describe('ConfirmPopover', () => {
|
||||
it('confirms with its button, which has the focus (Enter)', () => {
|
||||
const onConfirm = vi.fn();
|
||||
render(<ConfirmPopover x={100} y={100} message="Ordner löschen?" confirmLabel="In den Papierkorb" onConfirm={onConfirm} onCancel={vi.fn()} />);
|
||||
const button = screen.getByRole('button', { name: 'In den Papierkorb' });
|
||||
expect(document.activeElement).toBe(button);
|
||||
fireEvent.click(button);
|
||||
expect(onConfirm).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('closes without confirming on Abbrechen, Escape or a click outside', () => {
|
||||
const onConfirm = vi.fn();
|
||||
const onCancel = vi.fn();
|
||||
render(<ConfirmPopover x={100} y={100} message="Ordner löschen?" confirmLabel="Löschen" onConfirm={onConfirm} onCancel={onCancel} />);
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Abbrechen' }));
|
||||
fireEvent.keyDown(document, { key: 'Escape' });
|
||||
fireEvent.pointerDown(document.body);
|
||||
expect(onCancel).toHaveBeenCalledTimes(3);
|
||||
expect(onConfirm).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user