Skip to content

Commit

Permalink
Merge branch 'UIIN-3171' of https://github.com/folio-org/ui-inventory
Browse files Browse the repository at this point in the history
…into UIIN-3171
  • Loading branch information
OleksandrHladchenko1 committed Feb 5, 2025
2 parents 99b4be8 + 50a20e7 commit 43b77f5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* ECS: Disable opening item details if a user is not affiliated with item's member tenant. Fixes UIIN-3187.
* Correctly depend on `inflected`. Refs UIIN-3203.
* Decrease the amount of rerenders in `ConsortialHoldings` component. Fixes UIIN-3196.
* Add Version history button and Version history pane to details view of Item. Refs UIIN-3172.
* Add Version history button and Version history pane to details view of Holdings. Refs UIIN-3171.

## [12.0.12](https://github.com/folio-org/ui-inventory/tree/v12.0.12) (2025-01-27)
Expand Down
6 changes: 5 additions & 1 deletion src/views/ItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,11 @@ const ItemView = props => {
dismissible
onClose={onCloseViewItem}
actionMenu={getActionMenu}
lastMenu={<PaneMenu><VersionHistoryButton onClick={openVersionHistory} /></PaneMenu>}
lastMenu={(
<PaneMenu>
<VersionHistoryButton onClick={openVersionHistory} />
</PaneMenu>
)}
>
<UpdateItemOwnershipModal
isOpen={isUpdateOwnershipModalOpen}
Expand Down
36 changes: 36 additions & 0 deletions src/views/ItemView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
fireEvent,
within,
} from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';
import { runAxeTest } from '@folio/stripes-testing';

import '../../test/jest/__mock__';
Expand Down Expand Up @@ -296,6 +297,41 @@ describe('ItemView', () => {
expect(mockPush).toHaveBeenCalled();
});
});

describe('Version history component', () => {
let versionHistoryButton;

beforeEach(() => {
const { container } = renderWithIntl(<ItemViewSetup />, translationsProperties);

versionHistoryButton = container.querySelector('#version-history-btn');
});

it('should render version history button', () => {
expect(versionHistoryButton).toBeInTheDocument();
});

describe('when click the button', () => {
it('should render version history pane', async () => {
await userEvent.click(versionHistoryButton);
expect(screen.getByRole('region', { name: /version history/i })).toBeInTheDocument();
});
});

describe('when click the close button', () => {
it('should hide the pane', async () => {
await userEvent.click(versionHistoryButton);

const versionHistoryPane = await screen.findByRole('region', { name: /version history/i });
expect(versionHistoryPane).toBeInTheDocument();

const closeButton = await within(versionHistoryPane).findByRole('button', { name: /close/i });
await userEvent.click(closeButton);

expect(screen.queryByRole('region', { name: /version history/i })).not.toBeInTheDocument();
});
});
});
});

describe('action menu', () => {
Expand Down
4 changes: 3 additions & 1 deletion translations/ui-inventory/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,5 +879,7 @@
"settings.section.displaySettings": "Display settings",
"settings.displaySettings.defaultSort": "Default sort",

"instance.linked.id": "Linked instance ID - {id}"
"instance.linked.id": "Linked instance ID - {id}",

"versionHistory.paneTitle": "Version history"
}

0 comments on commit 43b77f5

Please sign in to comment.