test: add type test for Input

This commit is contained in:
afc163 2022-03-17 11:19:38 +08:00
parent 310c7775d9
commit 86b045e12c

View File

@ -0,0 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import Input from '..';
import { InputProps } from '../Input';
describe('Input types', () => {
it('should support data-attributes', () => {
const dataProps: InputProps = {
'data-test': 'test',
size: 'large',
};
const wrapper = mount(<Input {...dataProps} />);
expect(wrapper.find('input').prop('data-test')).toBe('test');
const wrapper2 = mount(<Input data-test="test" size="large" />);
expect(wrapper2.find('input').prop('data-test')).toBe('test');
});
});