Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/__tests__/datepicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const CustomInput = React.forwardRef<Input, InputProps>((props, ref) => {

return (
<Form.Field>
{label && <label>{label}</label>}
{label && <label htmlFor={rest.id as string | undefined}>{label}</label>}
<Input
data-testid="datepicker-input"
{...rest}
Expand Down