mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 20:36:21 -05:00
Video page: move Delete into the Edit dropdown
The Edit dropdown now holds Refresh, Transcode and Delete, so the action row is Download / Edit / Add to Playlist. Delete keeps its confirmation (a Confirm dialog) and the tagged-files prompt, and is disabled in WROL Mode like the other items. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
e480a386d0
commit
712d89c424
3 changed files with 72 additions and 13 deletions
|
|
@ -182,13 +182,44 @@ describe('VideoEditMenu', () => {
|
|||
expect(screen.getByRole('menuitem', {name: /Transcode/})).toBeDisabled();
|
||||
});
|
||||
|
||||
test('WROL Mode disables both items', async () => {
|
||||
test('WROL Mode disables every item', async () => {
|
||||
renderWithProviders(
|
||||
<VideoEditMenu videoFile={videoFile} video={video} onRefresh={jest.fn()}/>,
|
||||
<VideoEditMenu videoFile={videoFile} video={video} onRefresh={jest.fn()} onDelete={jest.fn()}/>,
|
||||
wrolMode,
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button', {name: /Edit/}));
|
||||
expect(await screen.findByRole('menuitem', {name: /Refresh/})).toBeDisabled();
|
||||
expect(screen.getByRole('menuitem', {name: /Transcode/})).toBeDisabled();
|
||||
expect(screen.getByRole('menuitem', {name: /Delete/})).toBeDisabled();
|
||||
});
|
||||
|
||||
test('Delete asks for confirmation before calling onDelete', async () => {
|
||||
const onDelete = jest.fn().mockResolvedValue(undefined);
|
||||
renderWithProviders(
|
||||
<VideoEditMenu videoFile={videoFile} video={video} onRefresh={jest.fn()} onDelete={onDelete}/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: /Edit/}));
|
||||
fireEvent.click(await screen.findByRole('menuitem', {name: /Delete/}));
|
||||
expect(await screen.findByText('Delete video?')).toBeInTheDocument();
|
||||
expect(onDelete).not.toHaveBeenCalled();
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', {name: 'Delete'}));
|
||||
await waitFor(() => expect(onDelete).toHaveBeenCalledTimes(1));
|
||||
});
|
||||
|
||||
test('backing out of the Delete confirmation deletes nothing', async () => {
|
||||
const onDelete = jest.fn();
|
||||
renderWithProviders(
|
||||
<VideoEditMenu videoFile={videoFile} video={video} onRefresh={jest.fn()} onDelete={onDelete}/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: /Edit/}));
|
||||
fireEvent.click(await screen.findByRole('menuitem', {name: /Delete/}));
|
||||
expect(await screen.findByText('Delete video?')).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: 'Cancel'}));
|
||||
await waitFor(() => expect(screen.queryByText('Delete video?')).not.toBeInTheDocument());
|
||||
expect(onDelete).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue