Skip to content
Snippets Groups Projects
Commit 72d939b6 authored by Nolan Lawson's avatar Nolan Lawson Committed by Eugen Rochko
Browse files

Fix thinking_face emoji autocomplete (#5238)

parent 97b3d0cd
No related branches found
No related tags found
No related merge requests found
...@@ -125,13 +125,16 @@ function getData(emoji) { ...@@ -125,13 +125,16 @@ function getData(emoji) {
} }
function intersect(a, b) { function intersect(a, b) {
let aSet = new Set(a); let set;
let bSet = new Set(b); let list;
let intersection = new Set( if (a.length < b.length) {
[...aSet].filter(x => bSet.has(x)) set = new Set(a);
); list = b;
} else {
return Array.from(intersection); set = new Set(b);
list = a;
}
return Array.from(new Set(list.filter(x => set.has(x))));
} }
export { getData, getSanitizedData, intersect }; export { getData, getSanitizedData, intersect };
...@@ -96,4 +96,11 @@ describe('emoji_index', () => { ...@@ -96,4 +96,11 @@ describe('emoji_index', () => {
expect(search('polo').map(trimEmojis)).to.deep.equal(expected); expect(search('polo').map(trimEmojis)).to.deep.equal(expected);
expect(emojiIndex.search('polo').map(trimEmojis)).to.deep.equal(expected); expect(emojiIndex.search('polo').map(trimEmojis)).to.deep.equal(expected);
}); });
it('can search for thinking_face', () => {
let expected = [ { id: 'thinking_face', unified: '1f914', native: '🤔' } ];
expect(search('thinking_fac').map(trimEmojis)).to.deep.equal(expected);
// this is currently broken in emoji-mart
// expect(emojiIndex.search('thinking_fac').map(trimEmojis)).to.deep.equal(expected);
});
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment