accounts-frontend/packages/app/components/ui/form/Input.test.tsx

28 lines
807 B
TypeScript
Raw Permalink Normal View History

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