diff --git a/src/components/GitmojiList/__tests__/gitmojiList.spec.js b/src/components/GitmojiList/__tests__/gitmojiList.spec.js index 7e8392be16..a2c58180f1 100644 --- a/src/components/GitmojiList/__tests__/gitmojiList.spec.js +++ b/src/components/GitmojiList/__tests__/gitmojiList.spec.js @@ -65,6 +65,20 @@ describe('GitmojiList', () => { expect(instance.findAllByType('article').length).toEqual(1) }) + + it('should find the fire gitmoji by emoji', () => { + const wrapper = renderer.create() + const instance = wrapper.root + const query = '🔥' + + renderer.act(() => { + instance + .findByType('input') + .props.onChange({ target: { value: query } }) + }) + + expect(instance.findAllByType('article').length).toEqual(1) + }) }) describe('when search is provided by query string', () => { diff --git a/src/components/GitmojiList/index.js b/src/components/GitmojiList/index.js index 64d80f76ca..d977ae55c3 100644 --- a/src/components/GitmojiList/index.js +++ b/src/components/GitmojiList/index.js @@ -22,12 +22,13 @@ const GitmojiList = (props: Props): Element<'div'> => { const [isListMode, setIsListMode] = useLocalStorage('isListMode', false) const gitmojis = searchInput - ? props.gitmojis.filter(({ code, description }) => { + ? props.gitmojis.filter(({ emoji, code, description }) => { const lowerCasedSearch = searchInput.toLowerCase() return ( code.includes(lowerCasedSearch) || - description.toLowerCase().includes(lowerCasedSearch) + description.toLowerCase().includes(lowerCasedSearch) || + emoji == searchInput ) }) : props.gitmojis