import React from 'react'; import { Input } from '../source/components/Input'; import { renderInSimpleTheme } from './helpers/theming'; test('Input renders correctly', () => { expect(renderInSimpleTheme()).toMatchSnapshot(); }); test('Input renders with placeholder', () => { expect(renderInSimpleTheme()).toMatchSnapshot(); }); test('Input renders with a value', () => { expect( renderInSimpleTheme() ).toMatchSnapshot(); }); test('Input is readOnly', () => { expect(renderInSimpleTheme()).toMatchSnapshot(); }); test('Input renders with data-* attributes', () => { const wrapper = renderInSimpleTheme(); expect(wrapper.find('input').prop('data-testid')).toEqual('testId'); }); test('Input renders label with htmlFor attribute', () => { const id = 'inputId'; const wrapper = renderInSimpleTheme(); expect(wrapper.find('input').prop('id')).toEqual(id); expect(wrapper.find('label').prop('for')).toEqual(id); });