test: add test for short_names in custom emoji
parent
3c0c0caffc
commit
39fc02bfe3
|
@ -134,7 +134,7 @@ export default class Category extends React.Component {
|
||||||
updateDisplay(display) {
|
updateDisplay(display) {
|
||||||
var emojis = this.getEmojis()
|
var emojis = this.getEmojis()
|
||||||
|
|
||||||
if (!emojis) {
|
if (!emojis || !this.container) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import NimblePicker from '../nimble-picker'
|
import NimblePicker from '../nimble-picker'
|
||||||
|
import NimbleEmojiIndex from '../../../utils/emoji-index/nimble-emoji-index'
|
||||||
import renderer from 'react-test-renderer'
|
import renderer from 'react-test-renderer'
|
||||||
|
|
||||||
import data from '../../../../data/apple'
|
import data from '../../../../data/apple'
|
||||||
|
@ -27,3 +28,37 @@ test('maintains category ids after it is filtered', () => {
|
||||||
const categoriesWithIds = subject.categories.filter((category) => category.id)
|
const categoriesWithIds = subject.categories.filter((category) => category.id)
|
||||||
expect(categoriesWithIds.length).toEqual(10)
|
expect(categoriesWithIds.length).toEqual(10)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('with custom emoji and tooltip', () => {
|
||||||
|
const custom = [
|
||||||
|
{
|
||||||
|
id: 'custom_name',
|
||||||
|
name: 'custom_name',
|
||||||
|
short_names: ['custom_name'],
|
||||||
|
text: '',
|
||||||
|
emoticons: [],
|
||||||
|
keywords: ['custom_name'],
|
||||||
|
imageUrl: 'https://example.com/emoji',
|
||||||
|
custom: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'custom_name2',
|
||||||
|
name: 'custom_name2',
|
||||||
|
short_names: ['custom_name2'],
|
||||||
|
text: '',
|
||||||
|
emoticons: [],
|
||||||
|
keywords: ['custom_name2'],
|
||||||
|
imageUrl: 'https://example.com/emoji',
|
||||||
|
custom: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const subject = render({
|
||||||
|
emojiTooltip: true,
|
||||||
|
autoFocus: true,
|
||||||
|
// emojisToShowFilter: emoji => emoji.id && emoji.id.startsWith('custom'),
|
||||||
|
custom,
|
||||||
|
})
|
||||||
|
subject.handleSearch(
|
||||||
|
new NimbleEmojiIndex(subject.data).search('custom_', { custom }),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
|
@ -355,7 +355,9 @@ export default class NimblePicker extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forceUpdate()
|
this.forceUpdate()
|
||||||
this.scroll.scrollTop = 0
|
if (this.scroll) {
|
||||||
|
this.scroll.scrollTop = 0
|
||||||
|
}
|
||||||
this.handleScroll()
|
this.handleScroll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue