mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-05 08:12:22 -08:00
fix: honor emoji selector threshold
This commit is contained in:
2 files changed
+15
No files matched your search
@@ -66,4 +66,17 @@ describe('EmoticonAutocomplete', () => {
|
||||
expect(menu).toBeInTheDocument();
|
||||
expect(screen.getByText(':zxy-face:')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('does not show the menu before the emoji threshold is reached', () => {
|
||||
render(
|
||||
<EmoticonAutocomplete
|
||||
controller={{} as ProseMirrorEditorController}
|
||||
imagePackRooms={[]}
|
||||
query={{ ...query, text: '' }}
|
||||
requestClose={vi.fn<() => void>()}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(document.querySelector('[data-autocomplete-menu]')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -105,6 +105,8 @@ export function EmoticonAutocomplete({
|
||||
});
|
||||
});
|
||||
|
||||
if (query.text.length < emojiThreshold) return null;
|
||||
|
||||
return (
|
||||
<AutocompleteMenu
|
||||
headerContent={<Text size="L400">{title ?? 'Emojis'}</Text>}
|
||||
|
||||
Reference in new issue
Block a user