implemented dynamic quick reactions by surfacing emojis from message content in the chat options dialog
This commit is contained in:
@@ -59,4 +59,52 @@ void main() {
|
||||
expect(standaloneEmojiFontSize('123'), isNull);
|
||||
});
|
||||
});
|
||||
|
||||
group('extractEmojis', () {
|
||||
test('returns empty list for plain text', () {
|
||||
expect(extractEmojis('Hallo Welt'), isEmpty);
|
||||
expect(extractEmojis(''), isEmpty);
|
||||
});
|
||||
|
||||
test('extracts emojis from mixed text, ties keep first appearance', () {
|
||||
expect(extractEmojis('Super 👍 gemacht 🎉'), ['👍', '🎉']);
|
||||
});
|
||||
|
||||
test('sorts by frequency, most-frequent first', () {
|
||||
// 🎉 appears first but 👍 occurs more often → 👍 wins.
|
||||
expect(extractEmojis('🎉 👍 super 👍'), ['👍', '🎉']);
|
||||
});
|
||||
|
||||
test('dedupes repeated emojis, most-frequent first', () {
|
||||
expect(extractEmojis('😀 😀 🚀 😀'), ['😀', '🚀']);
|
||||
});
|
||||
|
||||
test('extracts composite emojis as single entries', () {
|
||||
expect(extractEmojis('Familie 👨👩👧👦 und 👍🏽'), ['👨👩👧👦', '👍🏽']);
|
||||
});
|
||||
|
||||
test('extracts flag emojis', () {
|
||||
expect(extractEmojis('Hallo 🇩🇪'), ['🇩🇪']);
|
||||
});
|
||||
});
|
||||
|
||||
group('emojiSkinToneNeutral', () {
|
||||
test('strips skin-tone modifiers', () {
|
||||
expect(emojiSkinToneNeutral('👍🏻'), '👍');
|
||||
expect(emojiSkinToneNeutral('👍🏿'), '👍');
|
||||
});
|
||||
|
||||
test('leaves emojis without skin tone unchanged', () {
|
||||
expect(emojiSkinToneNeutral('👍'), '👍');
|
||||
expect(emojiSkinToneNeutral('❤️'), '❤️');
|
||||
expect(emojiSkinToneNeutral('🎉'), '🎉');
|
||||
});
|
||||
|
||||
test('tone variants compare equal after normalization', () {
|
||||
expect(
|
||||
emojiSkinToneNeutral('👍🏻'),
|
||||
emojiSkinToneNeutral('👍🏽'),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user