diff --git a/UNRELEASED.md b/UNRELEASED.md index 9154ae3a2b2..926214c7f0d 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -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 diff --git a/src/components/AfterInitialMount/test/AfterInitialMount.test.tsx b/src/components/AfterInitialMount/test/AfterInitialMount.test.tsx index c6afab0f23e..a87aae29d47 100644 --- a/src/components/AfterInitialMount/test/AfterInitialMount.test.tsx +++ b/src/components/AfterInitialMount/test/AfterInitialMount.test.tsx @@ -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'; @@ -12,7 +12,7 @@ describe('AfterInitialMount', () => { return null; } - mount(} />); + mountWithApp(} />); expect(spy).toHaveBeenCalledTimes(1); }); @@ -31,7 +31,7 @@ describe('AfterInitialMount', () => { return null; } - const afterInitialMount = mount( + const afterInitialMount = mountWithApp( }> , diff --git a/src/components/AppProvider/tests/AppProvider.test.tsx b/src/components/AppProvider/tests/AppProvider.test.tsx index 5628bd9e879..60b59f194de 100644 --- a/src/components/AppProvider/tests/AppProvider.test.tsx +++ b/src/components/AppProvider/tests/AppProvider.test.tsx @@ -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'; @@ -19,21 +17,21 @@ describe('', () => { }); it('updates context when props change', () => { - const Child: React.SFC = () => { + const Child: React.FunctionComponent = () => { return useContext(LinkContext) ?
: null; }; const LinkComponent = () =>
; - const wrapper = mountWithAppProvider( + const wrapper = mountWithApp( , ); - 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); + wrapper.forceUpdate(); + expect(wrapper).toContainReactComponent('div', {id: 'child'}); }); it('renders a MediaProvider', () => { diff --git a/src/components/IndexTable/IndexTable.scss b/src/components/IndexTable/IndexTable.scss index 5f5ccd43232..a41a135584e 100644 --- a/src/components/IndexTable/IndexTable.scss +++ b/src/components/IndexTable/IndexTable.scss @@ -148,6 +148,7 @@ $loading-panel-height: rem(53px); } } + // stylelint-disable-next-line selector-max-class &.TableRow-hovered.TableRow-selected { // stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity &,