diff --git a/src/__tests__/datepicker.test.tsx b/src/__tests__/datepicker.test.tsx index 27568ce1..e4a41110 100644 --- a/src/__tests__/datepicker.test.tsx +++ b/src/__tests__/datepicker.test.tsx @@ -236,6 +236,16 @@ describe('Basic datepicker', () => { expect(datePickerInput.value).toBe(''); }); + it('should be accessible when id is provided', () => { + const { getByLabelText, getByText } = setup({ + id: 'click-me', + label: 'Click me', + }); + + fireEvent.click(getByLabelText('Click me')); + expect(getByText('Today')).toBeTruthy(); + }); + describe('clearOnSameDateClick', () => { it('reset its state when prop is true', () => { const { datePickerInput, getByText, openDatePicker } = setup({ diff --git a/src/components/input.tsx b/src/components/input.tsx index 4d59cba9..e37d58b1 100644 --- a/src/components/input.tsx +++ b/src/components/input.tsx @@ -18,7 +18,7 @@ const CustomInput = React.forwardRef((props, ref) => { return ( - {label && } + {label && }