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 @@ -41,5 +41,6 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f
- Modernized tests for FormLayout and some components of ColorPicker ([#4330](https://github.com/Shopify/polaris-react/pull/4330))
- Modernized tests for Breadcrumbs, BulkActions, Button, ButtonGroup/Item, and ButtonGroup components([#4315](https://github.com/Shopify/polaris-react/pull/4315))
- Modernized tests for DualThumb ([#4341](https://github.com/Shopify/polaris-react/pull/4341))
- Modernized tests for AppProvider, AfterInitialMount components([#4315](https://github.com/Shopify/polaris-react/pull/4331))

### Deprecations
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect} from 'react';
import {mount} from 'test-utilities';
import {mountWithApp} from 'test-utilities/react-testing';

import {AfterInitialMount} from '../AfterInitialMount';

Expand All @@ -12,7 +12,7 @@ describe('AfterInitialMount', () => {
return null;
}

mount(<AfterInitialMount fallback={<Fallback />} />);
mountWithApp(<AfterInitialMount fallback={<Fallback />} />);
expect(spy).toHaveBeenCalledTimes(1);
});

Expand All @@ -31,7 +31,7 @@ describe('AfterInitialMount', () => {
return null;
}

const afterInitialMount = mount(
const afterInitialMount = mountWithApp(
<AfterInitialMount fallback={<Fallback />}>
<Children />
</AfterInitialMount>,
Expand Down
12 changes: 5 additions & 7 deletions src/components/AppProvider/tests/AppProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, {useContext} from 'react';
import {matchMedia} from '@shopify/jest-dom-mocks';
// eslint-disable-next-line no-restricted-imports
import {mountWithAppProvider} from 'test-utilities/legacy';
import {mountWithApp} from 'test-utilities/react-testing';
import {MediaQueryProvider} from 'components/MediaQueryProvider';

Expand All @@ -19,21 +17,21 @@ describe('<AppProvider />', () => {
});

it('updates context when props change', () => {
const Child: React.SFC = () => {
const Child: React.FunctionComponent = () => {
return useContext(LinkContext) ? <div id="child" /> : null;
};
const LinkComponent = () => <div />;

const wrapper = mountWithAppProvider(
const wrapper = mountWithApp(
<AppProvider i18n={{}}>
<Child />
</AppProvider>,
);

expect(wrapper.find('#child')).toHaveLength(0);
expect(wrapper).not.toContainReactComponent('div', {id: 'child'});
wrapper.setProps({linkComponent: LinkComponent});
wrapper.update();
expect(wrapper.find('#child')).toHaveLength(1);
Copy link

Choose a reason for hiding this comment

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

TIL

wrapper.forceUpdate();
expect(wrapper).toContainReactComponent('div', {id: 'child'});
});

it('renders a MediaProvider', () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/IndexTable/IndexTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ $loading-panel-height: rem(53px);
}
}

// stylelint-disable-next-line selector-max-class
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes breaking CI for max-class

&.TableRow-hovered.TableRow-selected {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity
&,
Expand Down