From 9048643a740462f5a3b74ec1bad7fd1914237961 Mon Sep 17 00:00:00 2001 From: Dmytro Melnyshyn Date: Mon, 23 Dec 2024 14:25:32 +0200 Subject: [PATCH] UIEH-1446: Add target='_blank' to the 'New' button of agreements accordion. --- CHANGELOG.md | 4 ++++ .../agreements-accordion.js | 1 + .../agreements-accordion.test.js | 17 +++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c35eee981..80056c948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change history for ui-eholdings +## [10.1.0] (IN PROGRESS) + +* Add `target="_blank"` to the `New` button of agreements accordion. (UIEH-1446) + ## [10.0.1] (https://github.com/folio-org/ui-eholdings/tree/v10.0.1) (2024-11-12) * Pass the `asyncFilter` property to the `Selection` component of packages. (UIEH-1439) diff --git a/src/features/agreements-accordion/agreements-accordion.js b/src/features/agreements-accordion/agreements-accordion.js index 225b2334c..36e2394d5 100644 --- a/src/features/agreements-accordion/agreements-accordion.js +++ b/src/features/agreements-accordion/agreements-accordion.js @@ -164,6 +164,7 @@ const AgreementsAccordion = ({ ref={ref} aria-labelledby={ariaIds.text} buttonClass={styles['new-button']} + target="_blank" to={`/erm/agreements/create?authority=${refType}&referenceId=${refId}`} > diff --git a/src/features/agreements-accordion/agreements-accordion.test.js b/src/features/agreements-accordion/agreements-accordion.test.js index c2924d038..dff48068d 100644 --- a/src/features/agreements-accordion/agreements-accordion.test.js +++ b/src/features/agreements-accordion/agreements-accordion.test.js @@ -89,22 +89,19 @@ describe('Given AgreementsAccordion', () => { expect(getByText('ui-eholdings.new')).toBeDefined(); }); - describe('after click on "New" button', () => { - it('should redirect to create page of agreements app', () => { - const { getByText } = renderAgreementsAccordion(); - - fireEvent.click(getByText('ui-eholdings.new')); - - expect(history.location.pathname + history.location.search).toEqual('/erm/agreements/create?authority=ref-type&referenceId=ref-id'); - }); - }); - it('should not display badge with agreements quantity', () => { const { queryByText } = renderAgreementsAccordion(); expect(queryByText('Badge')).toBeNull(); }); + it('should have correct props in the "New" button', () => { + const { getByText } = renderAgreementsAccordion(); + + expect(getByText('ui-eholdings.new')).toHaveAttribute('target', '_blank'); + expect(getByText('ui-eholdings.new')).toHaveAttribute('href', '/erm/agreements/create?authority=ref-type&referenceId=ref-id'); + }); + it('should render agreements list', () => { const { getByLabelText } = renderAgreementsAccordion();