[MM-30994] tweak emoji search options for better results (#5120)
* [MM-30994] tweak emooji search options for better results * Apply updated fuse options to emoji picker Co-authored-by: Miguel Alatzar <this.migbot@gmail.com>
This commit is contained in:
parent
9568a4592c
commit
f74e94d6cd
4 changed files with 13 additions and 12 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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(<EmojiSuggestion {...baseProps}/>);
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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(<EmojiPicker {...baseProps}/>);
|
||||
const result = wrapper.instance().searchEmojis(input);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue