UNPKG

@financial-times/n-conversion-forms

Version:

Containing jsx components and styles for forms included on Accounts and Acquisition apps (next-signup, next-profile, next-retention, etc).

54 lines (40 loc) 1.23 kB
import { YearOfBirth } from './index'; import { expectToRenderCorrectly } from '../test-jest/helpers/expect-to-render-correctly'; expect.extend(expectToRenderCorrectly); describe('YearOfBirth', () => { it('renders a year of birth input with default params', () => { const props = {}; expect(YearOfBirth).toRenderCorrectly(props); }); it(`renders a year of birth input with custom prompt`, () => { const props = { prompt: 'This helps us ensure people of all ages find value in the FT', }; expect(YearOfBirth).toRenderCorrectly(props); }); it(`renders a year of birth input with default error message`, () => { const props = { hasError: true, }; expect(YearOfBirth).toRenderCorrectly(props); }); it(`renders an optional year of birth input`, () => { const props = { isRequired: false, }; expect(YearOfBirth).toRenderCorrectly(props); }); it('render a year of birth input with default value', () => { const props = { value: '2001', }; expect(YearOfBirth).toRenderCorrectly(props); }); it('render a year of birth input with disabled field', () => { const props = { value: '2001', isDisabled: true, }; expect(YearOfBirth).toRenderCorrectly(props); }); });