2018-05-05 12:35:57 +05:30
|
|
|
import React from 'react';
|
2020-05-21 23:38:47 +05:30
|
|
|
import { render, screen } from '@testing-library/react';
|
2019-12-08 00:32:00 +05:30
|
|
|
import expect from 'app/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', () => {
|
2020-05-21 23:38:47 +05:30
|
|
|
let component: Input | null = null;
|
2019-12-07 16:58:52 +05:30
|
|
|
|
2020-05-21 23:38:47 +05:30
|
|
|
render(
|
2019-11-27 14:33:32 +05:30
|
|
|
<IntlProvider locale="en" defaultLocale="en">
|
|
|
|
<Input
|
|
|
|
defaultValue="foo"
|
|
|
|
name="test"
|
2020-05-20 22:05:52 +05:30
|
|
|
ref={(el) => {
|
2019-11-27 14:33:32 +05:30
|
|
|
component = el;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</IntlProvider>,
|
|
|
|
);
|
2018-05-05 12:35:57 +05:30
|
|
|
|
2020-05-21 23:38:47 +05:30
|
|
|
expect(screen.getByDisplayValue('foo'), 'to be a', HTMLElement);
|
|
|
|
expect(component && (component as Input).getValue(), 'to equal', 'foo');
|
2019-11-27 14:33:32 +05:30
|
|
|
});
|
2018-05-05 12:35:57 +05:30
|
|
|
});
|