feat(shortcuts): bind tracklist.delete to the confirmation
The binding has been in the defaults and in Settings since it was written, with nothing on the other end of it, because "remove from library" did not exist. It does now — and Delete only *opens* the dialog, never performs the removal, which is the only version defensible one keystroke from a focused row. The e2e case asserts the two things that matter and neither is the row count: the file is still on disk, and a real scan of the real directory does not bring the row back. It watches a control path survive the same scan, because a guard that excluded everything would pass the negative assertion for free — and it restores the database it spends.
This commit is contained in:
@@ -383,6 +383,35 @@ describe('shortcut dispatch: scope', () => {
|
||||
|
||||
expect(fired).toBe(1);
|
||||
});
|
||||
|
||||
/**
|
||||
* `tracklist.delete` was advertised in Settings for six phases with
|
||||
* nothing dispatching for it. What it dispatches now only *opens* a
|
||||
* confirmation, which is what makes a destructive action defensible
|
||||
* on an unmodified key one row from the user's music.
|
||||
*/
|
||||
it('dispatches for tracklist.delete, which had nothing on the other end', () => {
|
||||
bindings({ 'tracklist.delete': 'Delete' });
|
||||
|
||||
const panel = mount(document.createElement('div'));
|
||||
const row = document.createElement('div');
|
||||
|
||||
row.tabIndex = 0;
|
||||
panel.dataset['shortcutScope'] = 'tracklist';
|
||||
panel.append(row);
|
||||
row.focus();
|
||||
|
||||
let fired = 0;
|
||||
const listener = (): void => {
|
||||
fired += 1;
|
||||
};
|
||||
|
||||
document.addEventListener('shortcut:tracklist-delete', listener);
|
||||
press('Delete');
|
||||
document.removeEventListener('shortcut:tracklist-delete', listener);
|
||||
|
||||
expect(fired).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
// ===================================================================
|
||||
|
||||
Reference in New Issue
Block a user