Skip to content

Instantly share code, notes, and snippets.

@aeneasr
Created July 18, 2018 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aeneasr/9f6090355da09c7158e6df72de0c8d9f to your computer and use it in GitHub Desktop.
Save aeneasr/9f6090355da09c7158e6df72de0c8d9f to your computer and use it in GitHub Desktop.
import React from 'react'
import Enzyme from 'enzyme'
import { mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import DropDown from './index'
Enzyme.configure({ adapter: new Adapter() })
describe('DropDown input', () => {
const config = [{ title: 'one', value: '1' }, { title: 'two', value: '2' }, { title: 'three', value: '3' }]
it('should render', () => {
const wrapper = mount(
<div id="root">
<DropDown config={config} />
</div>
)
wrapper.find('div[role*="button"]').first().simulate('click')
wrapper.update()
config.forEach(({ title }) => {
expect(wrapper.html().indexOf(title)).toBeGreaterThan(-1)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment