Skip to content

Commit 0c93804

Browse files
committed
Add tests that verify presence of tabIndex prop for navigation buttons
1 parent 74a3790 commit 0c93804

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)