2018-05-05 12:35:57 +05:30
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
2019-06-30 19:02:50 +05:30
|
|
|
import expect from 'test/unexpected';
|
2018-05-05 12:35:57 +05:30
|
|
|
import { IntlProvider } from 'react-intl';
|
|
|
|
|
|
|
|
import Input from './Input';
|
|
|
|
|
|
|
|
describe('Input', () => {
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should return input value', () => {
|
2019-12-07 16:58:52 +05:30
|
|
|
let component: any;
|
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
const wrapper = mount(
|
|
|
|
<IntlProvider locale="en" defaultLocale="en">
|
|
|
|
<Input
|
|
|
|
defaultValue="foo"
|
|
|
|
name="test"
|
|
|
|
ref={el => {
|
|
|
|
component = el;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</IntlProvider>,
|
|
|
|
);
|
2018-05-05 12:35:57 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(
|
|
|
|
wrapper.find('input[name="test"]').getDOMNode().value,
|
|
|
|
'to equal',
|
|
|
|
'foo',
|
|
|
|
);
|
|
|
|
expect(component.getValue(), 'to equal', 'foo');
|
|
|
|
});
|
2018-05-05 12:35:57 +05:30
|
|
|
});
|