feat(transcription): decouple @mention display text from person search (#380) #629

Open
marcel wants to merge 41 commits from feat/issue-380-decouple-mention-search into main
Showing only changes of commit ff3e8fb755 - Show all commits

View File

@@ -7,9 +7,9 @@
* "no results" / "create new" behaviors. Wiring tests against Tiptap live
* in PersonMentionEditor.svelte.spec.ts.
*/
import { describe, it, expect, afterEach } from 'vitest';
import { describe, it, expect, afterEach, vi } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import { page, userEvent } from 'vitest/browser';
import MentionDropdown from './MentionDropdown.svelte';
import type { components } from '$lib/generated/api';
@@ -53,4 +53,20 @@ describe('MentionDropdown — search input', () => {
expect(input).not.toBeNull();
expect((input as HTMLInputElement).type).toBe('search');
});
it('invokes onSearch with the current value whenever the user types', async () => {
const onSearch = vi.fn();
render(MentionDropdown, {
model: makeModel(),
initialQuery: '',
onSearch
});
await userEvent.type(page.getByRole('searchbox'), 'Walter');
await vi.waitFor(() => {
expect(onSearch).toHaveBeenCalled();
expect(onSearch).toHaveBeenLastCalledWith('Walter');
});
});
});