mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-02 04:49:05 +00:00
fix(finder): open from inputs and find milestones by cue
Two defects surfaced while reviewing the feature. The search shortcut was dead while any input had focus. The hotkey hook skips input elements by default, so the shortcut did nothing while editing an entry title, which is exactly when a user reaches for it. Opt out of that behaviour and drop the local handler that partially worked around it, so a single binding both opens and closes. Milestones were skipped by the cue search even though they carry a cue and display it in the rundown, so filtering by cue could never find one. They are already covered by the title search. Adds e2e coverage for both, and fires the shortcut from a focused input in the existing keyboard test so the first defect stays fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DzALEq9gGWwFmwTdgAiFcY
This commit is contained in:
@@ -306,7 +306,10 @@ test('Finder navigates to the result picked with the keyboard', async ({ page })
|
||||
await page.getByTestId('entry-2').getByTestId('entry__title').fill('finder two');
|
||||
await page.getByTestId('entry-2').getByTestId('entry__title').press('Enter');
|
||||
|
||||
// deliberately fired while the caret is still in a title field: the shortcut must not be
|
||||
// swallowed by the input the user happens to be editing
|
||||
await page.keyboard.press('ControlOrMeta+f');
|
||||
await expect(page.getByPlaceholder('Search...')).toBeVisible();
|
||||
await page.getByPlaceholder('Search...').fill('finder');
|
||||
await expect(page.getByTestId('finder-result')).toHaveCount(2);
|
||||
|
||||
@@ -319,6 +322,40 @@ test('Finder navigates to the result picked with the keyboard', async ({ page })
|
||||
await expect(page.getByTestId('entry-2').getByTestId('rundown-event')).toHaveAttribute('data-selected', 'true');
|
||||
});
|
||||
|
||||
test('Finder searches milestones by cue', async ({ page }) => {
|
||||
await page.goto('/rundown');
|
||||
await page.getByRole('button', { name: 'Edit' }).click();
|
||||
|
||||
// clear rundown
|
||||
await page.getByRole('button', { name: 'Rundown menu' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Clear all' }).click();
|
||||
await page.getByRole('button', { name: 'Delete all' }).click();
|
||||
await expect(page.getByTestId('rundown-event')).toHaveCount(0);
|
||||
|
||||
// an event, and a milestone carrying its own cue
|
||||
await page.getByRole('button', { name: 'Create Event' }).click();
|
||||
await page.getByTestId('entry-1').click();
|
||||
await page.getByTestId('entry__title').press('Escape');
|
||||
await page.getByTestId('rundown-event').locator('div').filter({ hasText: '1' }).press('Alt+M');
|
||||
await expect(page.getByTestId('rundown-milestone')).toHaveCount(1);
|
||||
|
||||
await page.getByTestId('rundown-milestone').getByPlaceholder('Cue').fill('MILE9');
|
||||
await page.getByTestId('rundown-milestone').getByPlaceholder('Cue').press('Enter');
|
||||
await page.getByTestId('rundown-milestone').getByPlaceholder('Title').fill('zebrafish');
|
||||
await page.getByTestId('rundown-milestone').getByPlaceholder('Title').press('Enter');
|
||||
|
||||
await page.keyboard.press('ControlOrMeta+f');
|
||||
await expect(page.getByPlaceholder('Search...')).toBeVisible();
|
||||
|
||||
// milestones were previously skipped by the cue search even though they carry a cue
|
||||
await page.getByPlaceholder('Search...').fill('cue MILE9');
|
||||
await expect(page.getByTestId('finder-result')).toHaveCount(1);
|
||||
|
||||
// and remain findable by title
|
||||
await page.getByPlaceholder('Search...').fill('zebrafish');
|
||||
await expect(page.getByTestId('finder-result')).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('Open settings', async ({ page }) => {
|
||||
await page.goto('/editor');
|
||||
await expect(page.getByTestId('editor-container')).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user