-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* UIIN-2802 Retain browse query when switching Inventory browse options (#2417) * UIIN-2802 Keep query when changing Browse options * UIIN-2802 Update changelog * UIIN-2802 Remove unneeded mock code * UIIN-2802 Update changelog (cherry picked from commit 1477513) * UIIN-2802 Set prevSearchIndex when perfoming Browse, not when changing option (#2424) (cherry picked from commit fdbf09e) * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record (#2416) * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * Update utils.test.js * UIIN-2784: Throw error in catch block * UIIN-2784: Remove try catch * UIIN-2784: Throw exception if response is failed * UIIN-2784: Fix tests (cherry picked from commit 0ca01a0) * UIIN-2814 Apply staffSuppress.false in Holdings/Items search (#2420) * UIIN-2814 Fix staff suppress false not applied for first holdings/items search * UIIN-2814 Update changelog * UIIN-2814 fix issue with crash when filters are empty * UIIN-2814 Added tests for holdings staff suppress * UIIN-2814 Fix tests (cherry picked from commit 144db41) * UIIN-2814 Clear USER_TOUCHED_STAFF_SUPPRESS_STORAGE_KEY flag when switching between search segments (follow-up) (#2435) * UIIN-2814 Clear USER_TOUCHED_STAFF_SUPPRESS_STORAGE_KEY flag when switching between search segments * UIIN-2814 fix eslint (cherry picked from commit 4512f51) * UIIN-2815: Pass tenantId when open holding details during moving holdings/items (#2427) (cherry picked from commit cf33184) * UIIN-2780: ECS - Member consortial accordion is not displaying when user have according affiliation but don't have permissions for view holdings (#2429) (cherry picked from commit 7e785df) * Release v11.0.1 --------- Co-authored-by: Denys Bohdan <[email protected]> Co-authored-by: Oleksandr Hladchenko <[email protected]>
- Loading branch information
1 parent
8561dfe
commit aee9c87
Showing
63 changed files
with
1,644 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Instance/HoldingsList/Holding/HoldingAccordionLabel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Icon } from '@folio/stripes/components'; | ||
|
||
import { callNumberLabel } from '../../../utils'; | ||
|
||
const HoldingAccordionLabel = ({ | ||
location, | ||
holding, | ||
}) => { | ||
return ( | ||
<> | ||
<FormattedMessage | ||
id="ui-inventory.holdingsHeader" | ||
values={{ | ||
location, | ||
callNumber: callNumberLabel(holding), | ||
copyNumber: holding.copyNumber, | ||
}} | ||
/> | ||
{holding.discoverySuppress && | ||
<span> | ||
<Icon | ||
size="medium" | ||
icon="exclamation-circle" | ||
status="warn" | ||
/> | ||
</span> | ||
} | ||
</> | ||
); | ||
}; | ||
|
||
HoldingAccordionLabel.propTypes = { | ||
location: PropTypes.string, | ||
holding: PropTypes.object, | ||
}; | ||
|
||
export default HoldingAccordionLabel; |
34 changes: 34 additions & 0 deletions
34
src/Instance/HoldingsList/Holding/HoldingAccordionLabel.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { screen } from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import '../../../../test/jest/__mock__'; | ||
|
||
import { | ||
renderWithIntl, | ||
translationsProperties, | ||
} from '../../../../test/jest/helpers'; | ||
|
||
import HoldingAccordionLabel from './HoldingAccordionLabel'; | ||
|
||
const renderHoldingAccordionLabel = () => { | ||
const component = ( | ||
<HoldingAccordionLabel | ||
location="library location" | ||
holding={{ | ||
callNumberPrefix: 'callNumberPrefix', | ||
callNumber: 'callNumber', | ||
callNumberSuffix: 'callNumberSuffix', | ||
copyNumber: 'copyNumber' | ||
}} | ||
/> | ||
); | ||
|
||
return renderWithIntl(component, translationsProperties); | ||
}; | ||
|
||
describe('HoldingAccordionLabel', () => { | ||
it('should display correct holdings label', () => { | ||
renderHoldingAccordionLabel(); | ||
|
||
expect(screen.getByText(/holdings: library location > callNumberPrefix callNumber callNumberSuffix copyNumber/i)).toBeInTheDocument(); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
src/Instance/HoldingsList/Holding/HoldingButtonsGroup/AddItemButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Button } from '@folio/stripes/components'; | ||
import { useStripes } from '@folio/stripes/core'; | ||
|
||
import { switchAffiliation } from '../../../../utils'; | ||
|
||
const AddItemButton = ({ | ||
holding, | ||
tenantId, | ||
onAddItem, | ||
disabled, | ||
}) => { | ||
const stripes = useStripes(); | ||
|
||
return ( | ||
<Button | ||
id={`clickable-new-item-${holding.id}`} | ||
onClick={async () => { | ||
await switchAffiliation(stripes, tenantId, onAddItem); | ||
}} | ||
buttonStyle="primary paneHeaderNewButton" | ||
disabled={disabled} | ||
> | ||
<FormattedMessage id="ui-inventory.addItem" /> | ||
</Button> | ||
); | ||
}; | ||
|
||
AddItemButton.propTypes = { | ||
holding: PropTypes.object.isRequired, | ||
tenantId: PropTypes.string.isRequired, | ||
onAddItem: PropTypes.func.isRequired, | ||
disabled: PropTypes.bool, | ||
}; | ||
|
||
export default AddItemButton; |
48 changes: 48 additions & 0 deletions
48
src/Instance/HoldingsList/Holding/HoldingButtonsGroup/AddItemButton.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
fireEvent, | ||
screen, | ||
waitFor, | ||
} from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import '../../../../../test/jest/__mock__'; | ||
|
||
import { | ||
renderWithIntl, | ||
translationsProperties, | ||
} from '../../../../../test/jest/helpers'; | ||
|
||
import AddItemButton from './AddItemButton'; | ||
|
||
const mockOnAddItem = jest.fn(); | ||
|
||
const renderAddItemButton = () => { | ||
const component = ( | ||
<AddItemButton | ||
holding={{ id: 'holdingsId' }} | ||
tenantId="college" | ||
onAddItem={mockOnAddItem} | ||
/> | ||
); | ||
|
||
return renderWithIntl(component, translationsProperties); | ||
}; | ||
|
||
describe('AddItemButton', () => { | ||
it('should display Add item button', () => { | ||
renderAddItemButton(); | ||
|
||
expect(screen.getByRole('button', { name: /add item/i })).toBeInTheDocument(); | ||
}); | ||
|
||
describe('when clicking Add item button', () => { | ||
it('should call onAddItem callback', async () => { | ||
renderAddItemButton(); | ||
|
||
const addItem = screen.getByRole('button', { name: /add item/i }); | ||
|
||
fireEvent.click(addItem); | ||
|
||
await waitFor(() => expect(mockOnAddItem).toHaveBeenCalled()); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Instance/HoldingsList/Holding/HoldingButtonsGroup/ItemsCountBadge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { | ||
Badge, | ||
Icon, | ||
} from '@folio/stripes/components'; | ||
|
||
const ItemsCountBadge = ({ itemCount }) => { | ||
return <Badge>{itemCount ?? <Icon icon="spinner-ellipsis" width="10px" />}</Badge>; | ||
}; | ||
|
||
ItemsCountBadge.propTypes = { | ||
itemCount: PropTypes.number, | ||
}; | ||
|
||
export default ItemsCountBadge; |
24 changes: 24 additions & 0 deletions
24
src/Instance/HoldingsList/Holding/HoldingButtonsGroup/ItemsCountBadge.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { screen } from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import '../../../../../test/jest/__mock__'; | ||
|
||
import { | ||
renderWithIntl, | ||
translationsProperties, | ||
} from '../../../../../test/jest/helpers'; | ||
|
||
import ItemsCountBadge from './ItemsCountBadge'; | ||
|
||
const renderItemsCountBadge = () => { | ||
const component = <ItemsCountBadge itemCount={6} />; | ||
|
||
return renderWithIntl(component, translationsProperties); | ||
}; | ||
|
||
describe('ItemsCountBadge', () => { | ||
it('should display badge with item count', () => { | ||
renderItemsCountBadge(); | ||
|
||
expect(screen.getByText('6')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.