Fix link previews for messages with emojis

This commit is contained in:
Elias Zamaria
2025-08-15 15:20:59 -07:00
committed by Jamie Kyle
parent fd9f7a9fba
commit 2fb73bd753
2 changed files with 20 additions and 1 deletions

View File

@@ -116,6 +116,24 @@ describe('Link previews', () => {
assert.deepEqual(expected, actual);
});
it('returns all links after emojis with spaces in between, if a caretLocation is provided', () => {
const text = '😎 https://github.com/signalapp/Signal-Desktop';
const expected = ['https://github.com/signalapp/Signal-Desktop'];
const actual = findLinks(text, 45);
assert.deepEqual(expected, actual);
});
it('returns all links after a complex emoji, if a caretLocation is provided', () => {
const text = '👨‍👩‍👦 https://github.com/signalapp/Signal-Desktop';
const expected = ['https://github.com/signalapp/Signal-Desktop'];
const actual = findLinks(text, 45);
assert.deepEqual(expected, actual);
});
it('includes all links if cursor is not in a link', () => {
const text =
'Check out this link: https://github.com/signalapp/Signal-Desktop\nAnd this one too: https://github.com/signalapp/Signal-Android';