diff --git a/src/List/ListItem.js b/src/List/ListItem.js index 4b1b8bb90b651b..29e786ee9b1125 100644 --- a/src/List/ListItem.js +++ b/src/List/ListItem.js @@ -678,7 +678,6 @@ class ListItem extends Component { ', () => { ); assert.ok(wrapper.text(), 'Button', 'should say Button'); assert.ok(wrapper.is('button'), 'should match a button element'); + assert.strictEqual(wrapper.props().tabIndex, 0, 'should receive the focus'); }); it('renders a link when href is provided', () => { @@ -244,6 +245,17 @@ describe('', () => { assert.strictEqual(wrapper.find('FocusRipple').length, 0, 'should not have a FocusRipple'); }); + describe('prop: disabled', () => { + it('should have no ripples when button is disabled', () => { + const wrapper = shallowWithContext( + Button + ); + assert.strictEqual(wrapper.find('TouchRipple').length, 0, 'should not have a TouchRipple'); + assert.strictEqual(wrapper.find('FocusRipple').length, 0, 'should not have a FocusRipple'); + assert.strictEqual(wrapper.props().tabIndex, -1, 'should not receive the focus'); + }); + }); + it('should have no ripples when both are disabled', () => { const wrapper = shallowWithContext( ', () => { assert.strictEqual(wrapper.find('FocusRipple').length, 0, 'should not have a FocusRipple'); }); - it('should have no ripples when button is disabled', () => { - const wrapper = shallowWithContext( - Button - ); - assert.strictEqual(wrapper.find('TouchRipple').length, 0, 'should not have a TouchRipple'); - assert.strictEqual(wrapper.find('FocusRipple').length, 0, 'should not have a FocusRipple'); - }); - it('should fire the touchtap handler if keyboard focused and the enter or space keys are hit', () => { const eventStack = []; eventStack.reset = () => eventStack.splice(0, eventStack.length);