Skip to content

Commit

Permalink
Merge branch 'master' into 5331-re-enable-theming-panels
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Feb 13, 2020
2 parents e4e4087 + 57914e5 commit 6d7396d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/react/src/components/DatePicker/DatePicker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,25 @@ describe('DatePickerSkeleton', () => {
});
});
});

describe('Opening up calendar dropdown', () => {
const wrapper = mount(
<DatePicker datePickerType="range" className="extra-class">
<DatePickerInput labelText="Date Picker label" id="input-from" />
<DatePickerInput labelText="Date Picker label" id="input-to" />
</DatePicker>
);

it('has the range date picker with min and max dates', () => {
const datePicker = wrapper.instance();
const input = wrapper.find('input').at(0);

jest.spyOn(datePicker.cal, 'open');

input
.getDOMNode()
.dispatchEvent(new window.KeyboardEvent('keydown', { key: 'ArrowDown' }));

expect(datePicker.cal.open).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export default config => fp => {
// so user can move the keyboard cursor for editing dates
// Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
event.stopPropagation();
} else if (match(event, keys.ArrowDown)) {
event.preventDefault();
fp.open();
}
}
};
Expand Down

0 comments on commit 6d7396d

Please sign in to comment.