Skip to content

Commit

Permalink
Fix incomplete focus ripple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 25, 2019
1 parent 8b481aa commit 7b84128
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/material-ui/src/Tab/Tab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from 'chai';
import { spy } from 'sinon';
import { createMount, getClasses } from '@material-ui/core/test-utils';
import describeConformance from '../test-utils/describeConformance';
import { act, createClientRender } from 'test/utils/createClientRender';
import { act, createClientRender, fireEvent } from 'test/utils/createClientRender';
import Tab from './Tab';
import ButtonBase from '../ButtonBase';

Expand Down Expand Up @@ -45,8 +45,12 @@ describe('<Tab />', () => {
const { container, getByRole } = render(
<Tab TouchRippleProps={{ classes: { ripplePulsate: 'focus-ripple' } }} />,
);
// simulate pointer device
fireEvent.pointerDown(document.body);

act(() => {
fireEvent.keyDown(document.activeElement, { key: 'Tab' });
// jsdom doesn't actually support tab focus, we need to do it manually
getByRole('tab').focus();
});

Expand All @@ -57,8 +61,12 @@ describe('<Tab />', () => {
const { container, getByRole } = render(
<Tab disableFocusRipple TouchRippleProps={{ classes: { ripplePulsate: 'focus-ripple' } }} />,
);
// simulate pointer device
fireEvent.pointerDown(document.body);

act(() => {
fireEvent.keyDown(document.activeElement, { key: 'Tab' });
// jsdom doesn't actually support tab focus, we need to do it manually
getByRole('tab').focus();
});

Expand Down

0 comments on commit 7b84128

Please sign in to comment.