Skip to content

Commit

Permalink
UIIN-2636: Replace imports from quick-marc with stripes-marc-componen…
Browse files Browse the repository at this point in the history
…ts. (#2320)
  • Loading branch information
Dmytro-Melnyshyn authored Oct 31, 2023
1 parent e83ab07 commit 9fcfe3e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change history for ui-inventory

## [11.0.0] IN PROGRESS

* *BREAKING* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636.

## [10.1.0] IN PROGRESS

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/inventory",
"version": "10.1.0",
"version": "11.0.0",
"description": "Inventory manager",
"repository": "folio-org/ui-inventory",
"publishConfig": {
Expand Down Expand Up @@ -862,6 +862,7 @@
"@folio/stripes-components": "^12.0.0",
"@folio/stripes-connect": "^9.0.0",
"@folio/stripes-core": "^10.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"@folio/stripes-smart-components": "^9.0.0",
"@folio/stripes-testing": "^4.6.0",
"@folio/stripes-util": "^6.0.0",
Expand All @@ -882,7 +883,6 @@
"zustand": "^4.1.1"
},
"dependencies": {
"@folio/quick-marc": "^7.0.0",
"@folio/stripes-acq-components": "^5.0.0",
"classnames": "^2.3.2",
"file-saver": "^2.0.0",
Expand All @@ -904,6 +904,7 @@
},
"peerDependencies": {
"@folio/stripes": "^9.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"react": "^18.2.0",
"react-intl": "^6.4.4",
"react-query": "^3.6.0",
Expand Down
8 changes: 5 additions & 3 deletions src/components/ViewSource/ViewSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import {
LoadingView,
} from '@folio/stripes/components';
import { useStripes } from '@folio/stripes/core';
import MarcView from '@folio/quick-marc/src/QuickMarcView/QuickMarcView';
import PrintPopup from '@folio/quick-marc/src/QuickMarcView/PrintPopup';
import { getHeaders } from '@folio/quick-marc/src/QuickMarcEditor/utils';
import {
MarcView,
PrintPopup,
getHeaders,
} from '@folio/stripes-marc-components';

import { useGoBack } from '../../common/hooks';

Expand Down
10 changes: 5 additions & 5 deletions src/components/ViewSource/ViewSource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ describe('ViewSource', () => {
});
});

it('should render QuickMarcView', () => {
expect(screen.getByText('QuickMarcView')).toBeInTheDocument();
it('should render MarcView', () => {
expect(screen.getByText('MarcView')).toBeInTheDocument();
});

it('should initiate useGoBack with correct path', () => {
expect(useGoBack).toBeCalledWith('/inventory/view/instance-id');
});

describe('when QuickMarcView is closed', () => {
describe('when MarcView is closed', () => {
it('should call onClose with correct url', async () => {
await waitFor(() => expect(screen.getByText('QuickMarcView')).toBeInTheDocument());
act(() => fireEvent.click(screen.getByText('QuickMarcView')));
await waitFor(() => expect(screen.getByText('MarcView')).toBeInTheDocument());
act(() => fireEvent.click(screen.getByText('MarcView')));
expect(mockGoBack).toBeCalledTimes(1);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/jest/__mock__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import './stripesCore.mock';
import './stripesIcon.mock';
import './stripesSmartComponents.mock';
import './InstancePlugin.mock';
import './quickMarc.mock';
import './stripesMarcComponents.mock';
import './stripesComponents.mock';
import './reactBeautifulDnd.mock';
import './react-virtualized-auto-sizer';
10 changes: 0 additions & 10 deletions test/jest/__mock__/quickMarc.mock.js

This file was deleted.

13 changes: 13 additions & 0 deletions test/jest/__mock__/stripesMarcComponents.mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

jest.mock('@folio/stripes-marc-components', () => ({
...jest.requireActual('@folio/stripes-marc-components'),
MarcView: jest.fn(({ onClose, marcTitle }) => (
<>
{marcTitle}
<button type="button" onClick={onClose}>
MarcView
</button>
</>
)),
}));

0 comments on commit 9fcfe3e

Please sign in to comment.