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