Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd1ab72

Browse files
authoredFeb 27, 2019
Merge pull request #1564 from nkinser/nk--add-tests-for-custom-navigation-tabindex
Add tests that verify presence of tabIndex prop for navigation buttons
2 parents 74a3790 + 0c93804 commit dd1ab72

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎test/components/DayPickerNavigation_spec.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ describe('DayPickerNavigation', () => {
1717
const wrapper = shallow(<DayPickerNavigation orientation={VERTICAL_SCROLLABLE} />).dive();
1818
expect(wrapper.find('[role="button"]')).to.have.lengthOf(1);
1919
});
20+
21+
it('tabindex is present when the default buttons are used', () => {
22+
const wrapper = shallow(<DayPickerNavigation />).dive();
23+
const prevMonthButton = wrapper.find('[role="button"]').at(0);
24+
const nextMonthButton = wrapper.find('[role="button"]').at(1);
25+
expect(prevMonthButton.prop('tabIndex')).to.equal('0');
26+
expect(nextMonthButton.prop('tabIndex')).to.equal('0');
27+
});
28+
29+
it('tabindex is present when custom buttons are used', () => {
30+
const wrapper = shallow(<DayPickerNavigation navNext={<div />} navPrev={<div />} />).dive();
31+
const prevMonthButton = wrapper.find('[role="button"]').at(0);
32+
const nextMonthButton = wrapper.find('[role="button"]').at(1);
33+
expect(prevMonthButton.prop('tabIndex')).to.equal('0');
34+
expect(nextMonthButton.prop('tabIndex')).to.equal('0');
35+
});
2036
});
2137

2238
describe('interactions', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.