From 487349f5125b9e278dcb266a34e27785ed078f18 Mon Sep 17 00:00:00 2001 From: Andrew Musgrave Date: Wed, 11 Sep 2019 14:47:17 -0400 Subject: [PATCH 1/2] Fixed test errors --- .../RollupActions/tests/RollupActions.test.tsx | 12 +++++++++--- src/components/Card/tests/Card.test.tsx | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/ActionMenu/components/RollupActions/tests/RollupActions.test.tsx b/src/components/ActionMenu/components/RollupActions/tests/RollupActions.test.tsx index a1db3f9e5b9..ace7e188f0b 100644 --- a/src/components/ActionMenu/components/RollupActions/tests/RollupActions.test.tsx +++ b/src/components/ActionMenu/components/RollupActions/tests/RollupActions.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {ReactWrapper} from 'enzyme'; import {HorizontalDotsMinor} from '@shopify/polaris-icons'; -import {mountWithAppProvider, trigger} from 'test-utilities/legacy'; +import {mountWithAppProvider, trigger, act} from 'test-utilities/legacy'; import {Button, Popover} from 'components'; @@ -60,7 +60,10 @@ describe('', () => { expect(popoverComponent.prop('active')).toBe(true); const firstActionListItem = wrapper.find(ActionListItem).first(); - trigger(firstActionListItem, 'onAction'); + act(() => { + trigger(firstActionListItem, 'onAction'); + }); + popoverComponent.update(); popoverComponent = wrapper.find(Popover); expect(popoverComponent.prop('active')).toBe(false); @@ -107,5 +110,8 @@ function findPopoverActivator(wrapper: Wrapper) { function activatePopover(wrapper: Wrapper) { const activator = findPopoverActivator(wrapper); - trigger(activator, 'onClick'); + act(() => { + trigger(activator, 'onClick'); + }); + wrapper.update(); } diff --git a/src/components/Card/tests/Card.test.tsx b/src/components/Card/tests/Card.test.tsx index f2c492201a2..957b7fba6c8 100644 --- a/src/components/Card/tests/Card.test.tsx +++ b/src/components/Card/tests/Card.test.tsx @@ -3,6 +3,7 @@ import { mountWithAppProvider, trigger, findByTestID, + act, } from 'test-utilities/legacy'; import {Card, Badge, Button, Popover, ActionList} from 'components'; import {WithinContentContext} from '../../../utilities/within-content-context'; @@ -140,8 +141,10 @@ describe('', () => { expect(popover).toHaveLength(1); expect(popover.prop('active')).toBe(false); - trigger(disclosureButton, 'onClick'); - + act(() => { + trigger(disclosureButton, 'onClick'); + }); + card.update(); expect( card .find(Popover) From de1605d61bf34ed28cd5a0c8cd6b8e0302211751 Mon Sep 17 00:00:00 2001 From: Andrew Musgrave Date: Wed, 11 Sep 2019 14:53:41 -0400 Subject: [PATCH 2/2] changelog --- UNRELEASED.md | 1 + 1 file changed, 1 insertion(+) diff --git a/UNRELEASED.md b/UNRELEASED.md index c9f71570bef..be6f7362a56 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -17,6 +17,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f - Fixed vertical alignment of Tabs disclosure activator ([#2087](https://github.com/Shopify/polaris-react/pull/2087)) - Fixed `Modal` setting an invalid `id` on `aria-labelledby` when no `title` is set ([#2115](https://github.com/Shopify/polaris-react/pull/2115)) +- Fixed error warnings in `Card` and `RollupActions` tests ([#2125](https://github.com/Shopify/polaris-react/pull/2125)) ### Documentation