Files
react/components/keyboard/__tests__/index.test.tsx
2020-04-21 12:26:44 +08:00

31 lines
830 B
TypeScript

import React from 'react'
import { mount, render } from 'enzyme'
import { Keyboard } from 'components'
describe('Keyboard', () => {
it('should render correctly', () => {
const wrapper = mount(<Keyboard>F</Keyboard>)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with modifiers', () => {
const wrapper = mount(
<div>
<Keyboard command>F</Keyboard>
<Keyboard shift>F</Keyboard>
<Keyboard option>F</Keyboard>
<Keyboard ctrl>F</Keyboard>
</div>
)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with small size', () => {
const wrapper = render(<Keyboard small>F</Keyboard>)
expect(wrapper).toMatchSnapshot()
})
})