Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Code quality

- Removed mocks in various tests suites that are now redundant ([#1978](https://github.com/Shopify/polaris-react/pull/1978))
- Bumped test coverage in `Collapsible` ([#1929](https://github.com/Shopify/polaris-react/pull/1929))
- Bumped test coverage in `DropZone`, `Frame`, `Icon`, and `Loading` ([#1927](https://github.com/Shopify/polaris-react/pull/1927))
- Removed unused type definitions ([#1862](https://github.com/Shopify/polaris-react/pull/1862))
Expand Down
11 changes: 0 additions & 11 deletions src/components/Collapsible/tests/Collapsible.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ import Collapsible from '../Collapsible';

describe('<Collapsible />', () => {
const ariaHiddenSelector = '[aria-hidden=true]';
let setTimeoutMock: jest.SpyInstance;

beforeEach(() => {
setTimeoutMock = jest
.spyOn(window, 'setTimeout')
.mockImplementation((cb: Function) => cb());
});

afterEach(() => {
setTimeoutMock.mockRestore();
});

it('does not render its children and indicates hidden with aria-hidden', () => {
const collapsible = mountWithAppProvider(
Expand Down
11 changes: 0 additions & 11 deletions src/components/Focus/tests/Focus.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ import Focus, {Props} from '../Focus';
import {Discard} from '../../../types';

describe('<Focus />', () => {
let requestAnimationFrameSpy: jest.SpyInstance;

beforeEach(() => {
requestAnimationFrameSpy = jest.spyOn(window, 'requestAnimationFrame');
requestAnimationFrameSpy.mockImplementation((cb) => cb());
});

afterEach(() => {
requestAnimationFrameSpy.mockRestore();
});

it('mounts', () => {
const focus = mountWithAppProvider(<FocusTestWrapper />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ import Tab from '../../Tab';
import Item from '../../Item';

describe('<TabMeasurer />', () => {
let requestAnimationFrameSpy: jest.SpyInstance;

beforeEach(() => {
requestAnimationFrameSpy = jest.spyOn(window, 'requestAnimationFrame');
requestAnimationFrameSpy.mockImplementation((cb) => cb());
});

afterEach(() => {
requestAnimationFrameSpy.mockRestore();
});

const mockProps = {
tabToFocus: 0,
activator: <Item id="id" focused />,
Expand Down
8 changes: 0 additions & 8 deletions src/components/TrapFocus/tests/TrapFocus.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,8 @@ import {
import TrapFocus from '../TrapFocus';

describe('<TrapFocus />', () => {
let requestAnimationFrameSpy: jest.SpyInstance;

beforeEach(() => {
requestAnimationFrameSpy = jest.spyOn(window, 'requestAnimationFrame');
requestAnimationFrameSpy.mockImplementation((cb) => cb());
});

afterEach(() => {
(document.activeElement as HTMLElement).blur();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we can remove this as well, how if we're expecting on the activeElement it's good practice.

requestAnimationFrameSpy.mockRestore();
});

it('mounts', () => {
Expand Down