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

Merged
marcel merged 41 commits from feat/issue-380-decouple-mention-search into main 2026-05-20 20:36:39 +02:00
Showing only changes of commit d4cfd4c8fd - Show all commits

View File

@@ -258,8 +258,19 @@ describe('MentionDropdown — search input', () => {
// same export so a regression in highlightedIndex/selection logic is caught
// at the unit level. The full E2E focus-chain test is deferred to a separate
// issue (Playwright).
//
// These unit tests directly invoke the exported `onKeyDown` to pin its
// behaviour in isolation. They do NOT exercise the Tiptap forwarding
// chain (PersonMentionEditor.suggestion.render() returning { onKeyDown })
// — that integration is covered by the 'ArrowDown moves the highlight'
// test in PersonMentionEditor.svelte.spec.ts. Sara on PR #629 round 3.
describe('MentionDropdown — onKeyDown forwarding', () => {
// flushSync ensures Svelte reactivity propagation completes before
// asserting (uniform across all four key tests so the next reader
// doesn't have to figure out why some are wrapped and others aren't).
// Felix #1 suggestion on PR #629 round 3.
it('ArrowDown advances aria-selected to the next option in the listbox', async () => {
const container = document.createElement('div');
document.body.appendChild(container);
@@ -338,7 +349,10 @@ describe('MentionDropdown — onKeyDown forwarding', () => {
try {
const exports = instance as unknown as { onKeyDown: (e: KeyboardEvent) => boolean };
const consumed = exports.onKeyDown(new KeyboardEvent('keydown', { key: 'Enter' }));
let consumed = false;
flushSync(() => {
consumed = exports.onKeyDown(new KeyboardEvent('keydown', { key: 'Enter' }));
});
expect(consumed).toBe(true);
expect(command).toHaveBeenCalledTimes(1);
expect(command.mock.calls[0][0].id).toBe('p1');
@@ -359,7 +373,10 @@ describe('MentionDropdown — onKeyDown forwarding', () => {
});
try {
const exports = instance as unknown as { onKeyDown: (e: KeyboardEvent) => boolean };
const consumed = exports.onKeyDown(new KeyboardEvent('keydown', { key: 'Escape' }));
let consumed = true;
flushSync(() => {
consumed = exports.onKeyDown(new KeyboardEvent('keydown', { key: 'Escape' }));
});
expect(consumed).toBe(false);
} finally {
unmount(instance);