Skip to content

Commit

Permalink
UIIN-3175: Add Version history pane for Item view component
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrHladchenko1 committed Jan 31, 2025
1 parent 423041a commit 79cb1c6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/views/ItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,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
35 changes: 35 additions & 0 deletions src/views/ItemView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,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', () => {
fireEvent.click(versionHistoryButton);

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

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

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

const closeButton = screen.getByRole('button', { name: /close version history/i });
fireEvent.click(closeButton);

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

describe('action menu', () => {
Expand Down

0 comments on commit 79cb1c6

Please sign in to comment.