Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneLem committed Jan 9, 2018
1 parent 94fc194 commit 68a4711
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
10 changes: 6 additions & 4 deletions spec/picker-spec.js
Expand Up @@ -35,9 +35,11 @@ describe('Picker', () => {
})

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);
});
subject = render({ emojisToShowFilter: emoji => true })
const categoriesWithIds = subject.categories.filter(
category => category.id
)
expect(categoriesWithIds.length).toEqual(10)
})
})
})
10 changes: 6 additions & 4 deletions src/components/emoji.js
Expand Up @@ -53,11 +53,11 @@ const _handleLeave = (e, props) => {
onLeave(emoji, e)
}

const _isNumeric = (value) => {
const _isNumeric = value => {
return !isNaN(value - parseFloat(value))
}

const _convertStyleToCSS = (style) => {
const _convertStyleToCSS = style => {
let div = document.createElement('div')

for (let key in style) {
Expand Down Expand Up @@ -145,7 +145,9 @@ const Emoji = props => {

if (props.html) {
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 {
return (
<span
Expand Down Expand Up @@ -197,7 +199,7 @@ Emoji.defaultProps = {
onOver: () => {},
onLeave: () => {},
onClick: () => {},
fallback: (emoji) => {},
fallback: emoji => {},
}

export default Emoji
2 changes: 1 addition & 1 deletion src/components/picker.js
Expand Up @@ -108,7 +108,7 @@ export default class Picker extends React.PureComponent {
let newCategory = {
emojis: newEmojis,
name: category.name,
id: category.id
id: category.id,
}

this.categories.push(newCategory)
Expand Down
4 changes: 1 addition & 3 deletions src/utils/emoji-index.js
Expand Up @@ -151,9 +151,7 @@ function search(

if (results) {
if (emojisToShowFilter) {
results = results.filter(result =>
emojisToShowFilter(pool[result.id])
)
results = results.filter(result => emojisToShowFilter(pool[result.id]))
}

if (results && results.length > maxResults) {
Expand Down

0 comments on commit 68a4711

Please sign in to comment.