Skip to content

Commit

Permalink
fix(DatePickerE): Drop value prop passed by Formik
Browse files Browse the repository at this point in the history
  • Loading branch information
jpveooys committed Dec 7, 2021
1 parent 86d4a65 commit a5bdb12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,15 @@ describe('DatePickerE', () => {
)
})

describe('when a startDate and value is specified', () => {
// @ts-ignore
const jsxToRender = <DatePickerE startDate={new Date()} value={null} />

it('does not throw an error', () => {
expect(() => render(jsxToRender)).not.toThrowError()
})
})

describe.skip('when `startDate` and `endDate` are updated externally', () => {
beforeEach(() => {
const initialProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface DatePickerEInputProps extends ComponentWithClass {
placeholder: string
setHasError: React.Dispatch<React.SetStateAction<boolean>>
to: Date
value?: never
}

export const DatePickerEInput = forwardRef<
Expand All @@ -41,6 +42,9 @@ export const DatePickerEInput = forwardRef<
onDayChange,
onFocus,
setHasError,
// Drop value as Formik passes it
// eslint-disable-next-line @typescript-eslint/no-unused-vars
value: _,
...rest
},
ref
Expand Down

0 comments on commit a5bdb12

Please sign in to comment.