Skip to content

Commit

Permalink
UIQM-522 Create/Derive a new MARC bib record & Create a MARC holdings…
Browse files Browse the repository at this point in the history
… | Default state of Save & close button should be disabled. (#628)

* UIQM-522 Create/Derive a new MARC bib record & Create a MARC holdings | Default state of Save & close button should be disabled.

* UIQM-522 Changed after code review
  • Loading branch information
BogdanDenis authored Dec 5, 2023
1 parent 7a0515c commit 72457a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [UIQM-574](https://issues.folio.org/browse/UIQM-574) Added authority source file selection button and modal to Authority Create view.
* [UIQM-591](https://issues.folio.org/browse/UIQM-591) Show permission `quickMARC: Create a new MARC authority record`. Don't load locations when MARC type is not Holdings.
* [UIQM-594](https://issues.folio.org/browse/UIQM-594) *BREAKING* Add authority-source-files interface.
* [UIQM-522](https://issues.folio.org/browse/UIQM-522) Create/Derive a new MARC bib record & Create a MARC holdings | Default state of Save & close button should be disabled.

## [7.0.4](https://github.com/folio-org/ui-quick-marc/tree/v7.0.4) (2023-11-09)

Expand Down
4 changes: 1 addition & 3 deletions src/QuickMarcEditor/QuickMarcEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ const QuickMarcEditor = ({
const type = leader?.content?.[6] || '';
const subtype = leader?.content?.[7] || '';

const saveFormDisabled = action === QUICK_MARC_ACTIONS.EDIT
? pristine || submitting
: submitting;
const saveFormDisabled = submitting ? true : pristine;

const redirectToVersion = useCallback((updatedVersion) => {
const searchParams = new URLSearchParams(location.search);
Expand Down
13 changes: 10 additions & 3 deletions src/QuickMarcEditor/QuickMarcEditor.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* eslint-disable max-lines */
import React from 'react';
import faker from 'faker';

import {
render,
fireEvent,
waitFor,
} from '@folio/jest-config-stripes/testing-library/react';
import faker from 'faker';

import { runAxeTest } from '@folio/stripes-testing';
import { useShowCallout } from '@folio/stripes-acq-components';

import '@folio/stripes-acq-components/test/jest/__mock__';

import QuickMarcEditor from './QuickMarcEditor';
Expand Down Expand Up @@ -184,6 +183,14 @@ describe('Given QuickMarcEditor', () => {

expect(getByText('ui-quick-marc.bibliographic-record.create.title')).toBeDefined();
});

it('should have Save & Close button disabled by default', () => {
const { getByRole } = renderQuickMarcEditor({
action: QUICK_MARC_ACTIONS.CREATE,
});

expect(getByRole('button', { name: 'stripes-acq-components.FormFooter.save' })).toBeDisabled();
});
});

it('should display pane footer', () => {
Expand Down

0 comments on commit 72457a7

Please sign in to comment.