Bug fix to ensure that the category ids are not dropped aftering being filtered.

nolan/hinaloe-test
Mark Wadden 2017-12-21 22:24:36 -05:00
parent bb2aff1c3f
commit 3c924a1619
2 changed files with 7 additions and 0 deletions

View File

@ -33,5 +33,11 @@ describe('Picker', () => {
subject = render({ emojisToShowFilter: unified => false }) subject = render({ emojisToShowFilter: unified => false })
expect(subject.categories.length).toEqual(2) 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);
});
}) })
}) })

View File

@ -108,6 +108,7 @@ export default class Picker extends React.PureComponent {
let newCategory = { let newCategory = {
emojis: newEmojis, emojis: newEmojis,
name: category.name, name: category.name,
id: category.id
} }
this.categories.push(newCategory) this.categories.push(newCategory)