diff --git a/spec/picker-spec.js b/spec/picker-spec.js index 7ae20fc..02bce72 100644 --- a/spec/picker-spec.js +++ b/spec/picker-spec.js @@ -33,5 +33,11 @@ describe('Picker', () => { subject = render({ emojisToShowFilter: unified => false }) expect(subject.categories.length).toEqual(2) }) + + it('maintains category ids after it is filtered', () => { + subject = render({emojisToShowFilter: emoji => true}); + const categoriesWithIds = subject.categories.filter(category => category.id); + expect(categoriesWithIds.length).toEqual(10); + }); }) }) diff --git a/src/components/picker.js b/src/components/picker.js index 2d1de18..dae7b04 100644 --- a/src/components/picker.js +++ b/src/components/picker.js @@ -108,6 +108,7 @@ export default class Picker extends React.PureComponent { let newCategory = { emojis: newEmojis, name: category.name, + id: category.id } this.categories.push(newCategory)