diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe57bb0a..ae7a60df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * React 19: refactor away from react-dom/test-utils. Refs UIIN-2888. * Add call number browse settings. Refs UIIN-3116. * Remove the ability to share local instance when `Inventory: View, create instances` permission is assigned. Fixes UIIN-3166. +* Display holdings names in `Consortial holdings` accordion for user without inventory permissions in member tenants. Fixes UIIN-3159 ## [12.0.7](https://github.com/folio-org/ui-inventory/tree/v12.0.7) (2024-12-17) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.6...v12.0.7) diff --git a/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.js b/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.js index 0cd1354f4..165962380 100644 --- a/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.js +++ b/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.js @@ -30,6 +30,7 @@ const LimitedHolding = ({ instance, holding, tenantId, + locationName, userTenantPermissions, pathToAccordionsState, }) => { @@ -56,7 +57,7 @@ const LimitedHolding = ({ const accordionLabel = ( ); @@ -105,6 +106,7 @@ LimitedHolding.propTypes = { instance: PropTypes.object.isRequired, holding: PropTypes.object.isRequired, tenantId: PropTypes.string.isRequired, + locationName: PropTypes.string.isRequired, userTenantPermissions: PropTypes.arrayOf(PropTypes.object).isRequired, pathToAccordionsState: PropTypes.arrayOf(PropTypes.string), }; diff --git a/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.test.js b/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.test.js index 27f45dfe6..6d1cc9e68 100644 --- a/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.test.js +++ b/src/Instance/HoldingsList/consortium/LimitedHolding/LimitedHolding.test.js @@ -37,6 +37,7 @@ const renderLimitedHolding = () => { instance={{ id: 'instanceId' }} holding={holdingsWithLimitedInfo} tenantId="college" + locationName="Location 1" userTenantPermissions={userTenantLimitedPermissions} pathToAccordionsState={[]} /> @@ -51,7 +52,7 @@ describe('LimitedHolding', () => { renderLimitedHolding(); expect(screen.getByRole('button', { - name: /holdings: > prefix callnumber copynumber/i + name: /holdings: Location 1 > prefix callnumber copynumber/i })).toBeInTheDocument(); }); diff --git a/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.js b/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.js index d8f9b6298..e90856712 100644 --- a/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.js +++ b/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.js @@ -1,5 +1,7 @@ +import { useContext } from 'react'; import PropTypes from 'prop-types'; +import { DataContext } from '../../../../contexts'; import { LimitedHolding } from '../LimitedHolding'; const LimitedHoldingsList = ({ @@ -9,12 +11,15 @@ const LimitedHoldingsList = ({ userTenantPermissions, pathToAccordionsState, }) => { + const { locationsById } = useContext(DataContext); + return holdings.map((holding, i) => ( diff --git a/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.test.js b/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.test.js index 0220e1e74..3649837a4 100644 --- a/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.test.js +++ b/src/Instance/HoldingsList/consortium/LimitedHoldingsList/LimitedHoldingsList.test.js @@ -6,6 +6,7 @@ import { translationsProperties, } from '../../../../../test/jest/helpers'; +import { DataContext } from '../../../../contexts'; import LimitedHoldingsList from './LimitedHoldingsList'; jest.mock('../LimitedHolding', () => ({ @@ -22,21 +23,34 @@ const holdings = [{ callNumberPrefix: 'prefix', callNumber: 'callNumber', copyNumber: 'copyNumber', + permanentLocationId: 'permanentLocationId_1', }, { id: 'holdingsId2', + permanentLocationId: 'permanentLocationId_2', }, { id: 'holdingsId3', + permanentLocationId: 'permanentLocationId_3', }]; +const providerValue = { + locationsById: { + permanentLocationId_1: { name: 'Location 1' }, + permanentLocationId_2: { name: 'Location 2' }, + permanentLocationId_3: { name: 'Location 3' }, + }, +}; + const renderLimitedHoldingsList = () => { const component = ( - + + + ); return renderWithIntl(component, translationsProperties);