diff --git a/src/settings/FinePolicy/FinePolicyForm.test.js b/src/settings/FinePolicy/FinePolicyForm.test.js
index e2937bb9..1b98202b 100644
--- a/src/settings/FinePolicy/FinePolicyForm.test.js
+++ b/src/settings/FinePolicy/FinePolicyForm.test.js
@@ -68,7 +68,7 @@ describe('FinePolicyForm', () => {
const policyForTest = new FinePolicy(mockedInitialValues);
const defaultProps = {
stripes: mockedStripes,
- pristine: false,
+ pristine: true,
submitting: false,
initialValues: mockedInitialValues,
handleSubmit: mockedHandleSubmit,
@@ -117,7 +117,7 @@ describe('FinePolicyForm', () => {
it('should execute "FooterPane" with passed props', () => {
expect(FooterPane).toHaveBeenCalledWith({
- isSaveButtonDisabled: false,
+ isSaveButtonDisabled: true,
onCancel: mockedOnCancel,
}, {});
});
@@ -173,11 +173,11 @@ describe('FinePolicyForm', () => {
});
});
- describe('when initialValues are passed ', () => {
+ describe('when form value was changed', () => {
const defaultTestProps = {
...defaultProps,
- pristine: true,
- submitting: true,
+ pristine: false,
+ submitting: false,
};
beforeEach(() => {
@@ -190,7 +190,7 @@ describe('FinePolicyForm', () => {
it('should render FooterPane with correct props', () => {
expect(FooterPane).toHaveBeenCalledWith({
- isSaveButtonDisabled: true,
+ isSaveButtonDisabled: false,
onCancel: mockedOnCancel,
}, {});
});
diff --git a/src/settings/LoanPolicy/LoanPolicyForm.test.js b/src/settings/LoanPolicy/LoanPolicyForm.test.js
index 22ab9e18..dc688fa3 100644
--- a/src/settings/LoanPolicy/LoanPolicyForm.test.js
+++ b/src/settings/LoanPolicy/LoanPolicyForm.test.js
@@ -324,4 +324,27 @@ describe('LoanPolicyForm', () => {
schedulesTest(testIds.renewalsSection);
});
});
+
+ describe('when form value was changed', () => {
+ const defaultTestProps = {
+ ...defaultProps,
+ pristine: false,
+ submitting: false,
+ };
+
+ beforeEach(() => {
+ render(
+
+ );
+ });
+
+ it('should render FooterPane with correct props', () => {
+ expect(FooterPane).toHaveBeenCalledWith({
+ isSaveButtonDisabled: false,
+ onCancel: mockedOnCancel,
+ }, {});
+ });
+ });
});
diff --git a/src/settings/LostItemFeePolicy/LostItemFeePolicyForm.test.js b/src/settings/LostItemFeePolicy/LostItemFeePolicyForm.test.js
index b9b9d751..a1020297 100644
--- a/src/settings/LostItemFeePolicy/LostItemFeePolicyForm.test.js
+++ b/src/settings/LostItemFeePolicy/LostItemFeePolicyForm.test.js
@@ -165,4 +165,27 @@ describe('LostItemFeePolicyForm', () => {
}), {});
});
});
+
+ describe('when form value was changed', () => {
+ const defaultTestProps = {
+ ...defaultProps,
+ pristine: false,
+ submitting: false,
+ };
+
+ beforeEach(() => {
+ render(
+
+ );
+ });
+
+ it('should render FooterPane with correct props', () => {
+ expect(FooterPane).toHaveBeenCalledWith({
+ isSaveButtonDisabled: false,
+ onCancel: mockedOnCancel,
+ }, {});
+ });
+ });
});
diff --git a/src/settings/NoticePolicy/NoticePolicyForm.test.js b/src/settings/NoticePolicy/NoticePolicyForm.test.js
index 6fb74b43..a311c8ad 100644
--- a/src/settings/NoticePolicy/NoticePolicyForm.test.js
+++ b/src/settings/NoticePolicy/NoticePolicyForm.test.js
@@ -218,4 +218,27 @@ describe('NoticePolicyForm', () => {
expect(screen.getByText(labelIds.createEntryLabel)).toBeInTheDocument();
});
});
+
+ describe('when form value was changed', () => {
+ const defaultTestProps = {
+ ...defaultProps,
+ pristine: false,
+ submitting: false,
+ };
+
+ beforeEach(() => {
+ render(
+
+ );
+ });
+
+ it('should render FooterPane with correct props', () => {
+ expect(FooterPane).toHaveBeenCalledWith({
+ isSaveButtonDisabled: false,
+ onCancel: mockedOnCancel,
+ }, {});
+ });
+ });
});
diff --git a/src/settings/PatronNotices/PatronNoticeForm.test.js b/src/settings/PatronNotices/PatronNoticeForm.test.js
index 985727fa..4f320a7e 100644
--- a/src/settings/PatronNotices/PatronNoticeForm.test.js
+++ b/src/settings/PatronNotices/PatronNoticeForm.test.js
@@ -86,7 +86,7 @@ describe('PatronNoticeForm', () => {
values: {}
};
});
- const testPristineValue = false;
+ const testPristineValue = true;
const testSubmittingValue = false;
const testHandleSubmit = jest.fn();
const testOnCancel = jest.fn();
@@ -153,7 +153,7 @@ describe('PatronNoticeForm', () => {
it('should render FooterPane with correct props', () => {
componentPropsCheck(FooterPane, testIds.patronNoticeFooterPane, {
- isSaveButtonDisabled: false,
+ isSaveButtonDisabled: true,
onCancel: testOnCancel,
});
});
@@ -201,15 +201,9 @@ describe('PatronNoticeForm', () => {
};
beforeEach(() => {
- const defaultProps = {
- ...defaultTestProps,
- pristine: true,
- submitting: true,
- };
-
render(
{
metadata: initialValues.metadata,
}), {});
});
-
- it('should render FooterPane with correct props', () => {
- componentPropsCheck(FooterPane, testIds.patronNoticeFooterPane, {
- isSaveButtonDisabled: true,
- onCancel: testOnCancel,
- });
- });
});
describe('print only', () => {
@@ -260,6 +247,7 @@ describe('PatronNoticeForm', () => {
}
};
});
+
render(
{
expect(screen.queryByTestId(testIds.form)).not.toBeInTheDocument();
});
});
+
+ describe('when form value was changed', () => {
+ const defaultProps = {
+ ...defaultTestProps,
+ pristine: false,
+ submitting: false,
+ };
+
+ beforeEach(() => {
+ render(
+
+ );
+ });
+
+ it('should render FooterPane with correct props', () => {
+ componentPropsCheck(FooterPane, testIds.patronNoticeFooterPane, {
+ isSaveButtonDisabled: false,
+ onCancel: testOnCancel,
+ });
+ });
+ });
});
diff --git a/src/settings/RequestPolicy/RequestPolicyForm.test.js b/src/settings/RequestPolicy/RequestPolicyForm.test.js
index 2defd111..3e820fba 100644
--- a/src/settings/RequestPolicy/RequestPolicyForm.test.js
+++ b/src/settings/RequestPolicy/RequestPolicyForm.test.js
@@ -79,7 +79,7 @@ describe('RequestPolicyForm', () => {
const pathname = '/policyId/test';
const defaultProps = {
okapi,
- pristine: false,
+ pristine: true,
stripes,
submitting: false,
onCancel,
@@ -153,7 +153,7 @@ describe('RequestPolicyForm', () => {
it('should executed FooterPane with correct props', () => {
expect(FooterPane).toHaveBeenCalledWith({
- isSaveButtonDisabled: false,
+ isSaveButtonDisabled: true,
onCancel,
}, {});
});
@@ -212,8 +212,8 @@ describe('RequestPolicyForm', () => {
};
const defaultTestProps = {
...defaultProps,
- pristine: true,
- submitting: true,
+ pristine: false,
+ submitting: false,
};
const testPolicy = new RequestPolicy(initialValues);
@@ -259,7 +259,7 @@ describe('RequestPolicyForm', () => {
it('should executed FooterPane with correct props', () => {
expect(FooterPane).toHaveBeenCalledWith({
- isSaveButtonDisabled: true,
+ isSaveButtonDisabled: false,
onCancel,
}, {});
});