release
Etienne Lemay 2018-01-09 15:20:18 -05:00
parent 94fc19491a
commit 68a4711658
4 changed files with 14 additions and 12 deletions

View File

@ -35,9 +35,11 @@ describe('Picker', () => {
}) })
it('maintains category ids after it is filtered', () => { it('maintains category ids after it is filtered', () => {
subject = render({emojisToShowFilter: emoji => true}); subject = render({ emojisToShowFilter: emoji => true })
const categoriesWithIds = subject.categories.filter(category => category.id); const categoriesWithIds = subject.categories.filter(
expect(categoriesWithIds.length).toEqual(10); category => category.id
}); )
expect(categoriesWithIds.length).toEqual(10)
})
}) })
}) })

View File

@ -53,11 +53,11 @@ const _handleLeave = (e, props) => {
onLeave(emoji, e) onLeave(emoji, e)
} }
const _isNumeric = (value) => { const _isNumeric = value => {
return !isNaN(value - parseFloat(value)) return !isNaN(value - parseFloat(value))
} }
const _convertStyleToCSS = (style) => { const _convertStyleToCSS = style => {
let div = document.createElement('div') let div = document.createElement('div')
for (let key in style) { for (let key in style) {
@ -145,7 +145,9 @@ const Emoji = props => {
if (props.html) { if (props.html) {
style = _convertStyleToCSS(style) style = _convertStyleToCSS(style)
return `<span style='${style}' ${title ? `title='${title}'` : ''} class='${className}'>${children || ''}</span>` return `<span style='${style}' ${title
? `title='${title}'`
: ''} class='${className}'>${children || ''}</span>`
} else { } else {
return ( return (
<span <span
@ -197,7 +199,7 @@ Emoji.defaultProps = {
onOver: () => {}, onOver: () => {},
onLeave: () => {}, onLeave: () => {},
onClick: () => {}, onClick: () => {},
fallback: (emoji) => {}, fallback: emoji => {},
} }
export default Emoji export default Emoji

View File

@ -108,7 +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 id: category.id,
} }
this.categories.push(newCategory) this.categories.push(newCategory)

View File

@ -151,9 +151,7 @@ function search(
if (results) { if (results) {
if (emojisToShowFilter) { if (emojisToShowFilter) {
results = results.filter(result => results = results.filter(result => emojisToShowFilter(pool[result.id]))
emojisToShowFilter(pool[result.id])
)
} }
if (results && results.length > maxResults) { if (results && results.length > maxResults) {