2018-05-05 10:05:57 +03:00
|
|
|
import React from 'react';
|
2020-05-21 21:08:47 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
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', () => {
|
2020-05-24 02:08:24 +03:00
|
|
|
it('should return input value', () => {
|
|
|
|
let component: Input | null = null;
|
2019-12-07 13:28:52 +02:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
render(
|
|
|
|
<IntlProvider locale="en" defaultLocale="en">
|
|
|
|
<Input
|
|
|
|
defaultValue="foo"
|
|
|
|
name="test"
|
|
|
|
ref={(el) => {
|
|
|
|
component = el;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</IntlProvider>,
|
|
|
|
);
|
2018-05-05 10:05:57 +03:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
expect(screen.getByDisplayValue('foo'), 'to be a', HTMLElement);
|
|
|
|
expect(component && (component as Input).getValue(), 'to equal', 'foo');
|
|
|
|
});
|
2018-05-05 10:05:57 +03:00
|
|
|
});
|