diff --git a/app/components/autocomplete/emoji_suggestion/emoji_suggestion.js b/app/components/autocomplete/emoji_suggestion/emoji_suggestion.js index 48f9e7ac7..3f53eac06 100644 --- a/app/components/autocomplete/emoji_suggestion/emoji_suggestion.js +++ b/app/components/autocomplete/emoji_suggestion/emoji_suggestion.js @@ -21,9 +21,7 @@ const EMOJI_REGEX = /(^|\s|^\+|^-)(:([^:\s]*))$/i; const EMOJI_REGEX_WITHOUT_PREFIX = /\B(:([^:\s]*))$/i; const FUSE_OPTIONS = { shouldSort: false, - threshold: 0.3, - location: 0, - distance: 10, + ignoreLocation: true, includeMatches: true, findAllMatches: true, }; diff --git a/app/components/autocomplete/emoji_suggestion/emoji_suggestion.test.js b/app/components/autocomplete/emoji_suggestion/emoji_suggestion.test.js index 20a7102a7..49d30b06d 100644 --- a/app/components/autocomplete/emoji_suggestion/emoji_suggestion.test.js +++ b/app/components/autocomplete/emoji_suggestion/emoji_suggestion.test.js @@ -46,9 +46,10 @@ describe('components/autocomplete/emoji_suggestion', () => { }); test('searchEmojis should return the right values on fuse', () => { - const output1 = ['100', '1234', '1st_place_medal', '+1', '-1', 'u7121']; + const output1 = ['100', '1234', '1st_place_medal', '+1', '-1', 'clock1', 'clock10', 'clock1030', 'clock11', 'clock1130', 'clock12', 'clock1230', 'clock130', 'rage1', 'u7121', 'u7981']; const output2 = ['+1']; - const output3 = ['-1']; + const output3 = ['-1', 'e-mail', 'non-potable_water']; + const output4 = ['checkered_flag', 'ballot_box_with_check', 'heavy_check_mark', 'white_check_mark']; const wrapper = shallowWithIntl(); wrapper.instance().searchEmojis(''); @@ -71,5 +72,11 @@ describe('components/autocomplete/emoji_suggestion', () => { setTimeout(() => { expect(wrapper.state('dataSource')).toEqual(output3); }, 100); + + wrapper.instance().searchEmojis('check'); + jest.runAllTimers(); + setTimeout(() => { + expect(wrapper.state('dataSource')).toEqual(output4); + }, 100); }); }); diff --git a/app/components/emoji_picker/emoji_picker.test.js b/app/components/emoji_picker/emoji_picker.test.js index 5c84dc377..32a17ca09 100644 --- a/app/components/emoji_picker/emoji_picker.test.js +++ b/app/components/emoji_picker/emoji_picker.test.js @@ -25,9 +25,7 @@ describe('components/emoji_picker/emoji_picker.ios', () => { const emojisBySection = selectEmojisBySection(state); const options = { shouldSort: false, - threshold: 0.3, - location: 0, - distance: 10, + ignoreLocation: true, includeMatches: true, findAllMatches: true, }; @@ -74,7 +72,7 @@ describe('components/emoji_picker/emoji_picker.ios', () => { test('searchEmojis should return the right values on fuse', async () => { const input = '1'; - const output = ['100', '1234', '1st_place_medal', '+1', '-1', 'u7121']; + const output = ['100', '1234', '1st_place_medal', '+1', '-1', 'clock1', 'clock10', 'clock1030', 'clock11', 'clock1130', 'clock12', 'clock1230', 'clock130', 'rage1', 'u7121', 'u7981']; const wrapper = shallowWithIntl(); const result = wrapper.instance().searchEmojis(input); diff --git a/app/components/emoji_picker/index.js b/app/components/emoji_picker/index.js index 0e38664ec..fb87c55ed 100644 --- a/app/components/emoji_picker/index.js +++ b/app/components/emoji_picker/index.js @@ -19,9 +19,7 @@ function mapStateToProps(state) { const emojis = selectEmojisByName(state); const options = { shouldSort: false, - threshold: 0.3, - location: 0, - distance: 10, + ignoreLocation: true, includeMatches: true, findAllMatches: true, };