From 1aa0ea24497089071d21f717f464d1dc6a87f6d5 Mon Sep 17 00:00:00 2001 From: Jeremy Nelson Date: Tue, 12 May 2020 13:34:29 -0600 Subject: [PATCH] Refactor CloseResourceModal to use state for clearing resource --- .../editor/actions/CloseResourceModal.test.js | 4 +--- __tests__/integration/multipleResources.test.js | 2 +- src/components/editor/actions/CloseButton.jsx | 2 +- src/components/editor/actions/CloseResourceModal.jsx | 12 +++++------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/__tests__/components/editor/actions/CloseResourceModal.test.js b/__tests__/components/editor/actions/CloseResourceModal.test.js index 5557fbbac..50fc55005 100644 --- a/__tests__/components/editor/actions/CloseResourceModal.test.js +++ b/__tests__/components/editor/actions/CloseResourceModal.test.js @@ -48,9 +48,8 @@ describe('', () => { }) it('clicking closes closes and invokes closeResource()', async () => { - const mockCloseResource = jest.fn() const { getByText } = renderWithRedux( - , + , store, ) fireEvent.click(getByText('Close')) @@ -58,6 +57,5 @@ describe('', () => { await wait(() => { expect(modalType(store.getState())).toBe(undefined) }) - expect(mockCloseResource).toBeCalled() }) }) diff --git a/__tests__/integration/multipleResources.test.js b/__tests__/integration/multipleResources.test.js index cc0239dfa..f631273c1 100644 --- a/__tests__/integration/multipleResources.test.js +++ b/__tests__/integration/multipleResources.test.js @@ -42,7 +42,7 @@ describe('Loading multiple resources', () => { await wait(() => expect(queryByText('Abbreviated Title', { selector: 'button' })).not.toBeInTheDocument()) // Close again - fireEvent.click(queryAllByText('Close')[0]) + fireEvent.click(queryAllByText('Close')[3]) // Back to Resource Template page expect(await findByText('BIBFRAME Instance')).toBeInTheDocument() diff --git a/src/components/editor/actions/CloseButton.jsx b/src/components/editor/actions/CloseButton.jsx index 4f786330f..938b79fe0 100644 --- a/src/components/editor/actions/CloseButton.jsx +++ b/src/components/editor/actions/CloseButton.jsx @@ -37,7 +37,7 @@ const CloseButton = (props) => { return ( - +