Merge pull request #154 from mwadden/master

Bug Fix: Ensure category ids are not dropped after emojisToShowFilter call
release
Etienne Lemay 2017-12-28 10:04:49 -05:00 committed by GitHub
commit 9675658e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)