Skip to content

Commit

Permalink
mj - dont tab to button on date input
Browse files Browse the repository at this point in the history
  • Loading branch information
mjewell committed Jul 20, 2017
1 parent 14c4355 commit f267b2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/components/DateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ export default class DateInput extends Component {
disabled={disabled}
/>
<InputGroupButton onClick={this.toggle}>
<Button className="px-2" disabled={disabled} active={open} type="button">
<Button
className="px-2"
disabled={disabled}
active={open}
type="button"
tabIndex={-1}
>
<Icon name="calendar" fixedWidth />
</Button>
</InputGroupButton>
Expand Down
15 changes: 11 additions & 4 deletions test/components/DateInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { DateInput } from '../../src';
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
import addDays from 'date-fns/add_days';
import addMonths from 'date-fns/add_months';
import addWeeks from 'date-fns/add_weeks';
import addYears from 'date-fns/add_years';
import assert from 'assert';
import isSameDay from 'date-fns/is_same_day';
import isToday from 'date-fns/is_today';
import { mount } from 'enzyme';
import sinon from 'sinon';

import { DateInput } from '../../src';

describe('<DateInput />', () => {
context('defaultValue', () => {
it('should default to blank and today', () => {
Expand Down Expand Up @@ -43,6 +42,14 @@ describe('<DateInput />', () => {
});
});

it('should not tab to the calendar button', () => {
const component = mount(<DateInput />);

const toggle = component.find('InputGroupButton');
const calendarButton = toggle.find('Button');
assert.equal(calendarButton.props().tabIndex, -1);
});

it('should should open and close when input addon clicked', () => {
const component = mount(<DateInput />);
const dropdown = component.find('Dropdown');
Expand Down

0 comments on commit f267b2d

Please sign in to comment.