emoji-mart-lazyload/spec/picker-spec.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-10-07 04:02:02 +00:00
import React from 'react'
import TestUtils from 'react-dom/test-utils'
2017-11-09 06:41:57 +00:00
import Picker from '../src/components/picker'
2017-10-07 04:02:02 +00:00
const { click } = TestUtils.Simulate
const {
renderIntoDocument,
scryRenderedComponentsWithType,
findRenderedComponentWithType,
2017-10-07 04:02:02 +00:00
} = TestUtils
2017-11-09 06:41:57 +00:00
const render = (props = {}) => {
const defaultProps = {}
return renderIntoDocument(<Picker {...defaultProps} {...props} />)
}
describe('Picker', () => {
2017-10-07 04:02:02 +00:00
let subject
it('works', () => {
2017-10-07 04:02:02 +00:00
subject = render()
expect(subject).toBeDefined()
})
2017-02-17 14:47:14 +00:00
describe('categories', () => {
it('shows 10 by default', () => {
2017-10-07 04:02:02 +00:00
subject = render()
expect(subject.categories.length).toEqual(10)
})
2017-02-17 14:47:14 +00:00
it('will not show some based upon our filter', () => {
2017-10-07 04:02:02 +00:00
subject = render({ emojisToShowFilter: unified => false })
expect(subject.categories.length).toEqual(2)
})
it('maintains category ids after it is filtered', () => {
2018-01-09 20:20:18 +00:00
subject = render({ emojisToShowFilter: emoji => true })
const categoriesWithIds = subject.categories.filter(
category => category.id
)
expect(categoriesWithIds.length).toEqual(10)
})
2017-10-07 04:02:02 +00:00
})
})