2018-05-05 12:35:57 +05:30
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import expect from 'unexpected';
|
|
|
|
import { IntlProvider } from 'react-intl';
|
|
|
|
|
|
|
|
import Input from './Input';
|
|
|
|
|
|
|
|
describe('Input', () => {
|
|
|
|
it('should return input value', () => {
|
|
|
|
let component;
|
|
|
|
const wrapper = mount(
|
|
|
|
<IntlProvider locale="en" defaultLocale="en">
|
|
|
|
<Input defaultValue="foo" name="test" ref={(el) => {component = el;}}/>
|
|
|
|
</IntlProvider>
|
|
|
|
);
|
|
|
|
|
2019-01-15 02:10:25 +05:30
|
|
|
expect(wrapper.find('input[name="test"]').getDOMNode().value, 'to equal', 'foo');
|
2018-05-05 12:35:57 +05:30
|
|
|
expect(component.getValue(), 'to equal', 'foo');
|
|
|
|
});
|
|
|
|
});
|