mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4479][ACA-4480] - Enable Save button when the form is invalid (#7131)
* [ACA-4479][ACA-4480] - Enable Save button when the form is invalid * Add a unit test for form cloud * Fix e2e
This commit is contained in:
@@ -123,7 +123,7 @@ export abstract class FormBaseComponent {
|
||||
|
||||
if (outcome) {
|
||||
if (outcome.name === FormOutcomeModel.SAVE_ACTION) {
|
||||
return this.disableSaveButton ? false : this.form.isValid;
|
||||
return !this.disableSaveButton;
|
||||
}
|
||||
if (outcome.name === FormOutcomeModel.COMPLETE_ACTION) {
|
||||
return this.disableCompleteButton ? false : this.form.isValid;
|
||||
|
@@ -870,6 +870,15 @@ describe('FormCloudComponent', () => {
|
||||
expect(formComponent.isOutcomeButtonEnabled(saveOutcome)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should save outcome button be enabled when the form is invalid', () => {
|
||||
const formModel = new FormModel(cloudFormMock);
|
||||
formComponent.form = formModel;
|
||||
formModel.isValid = false;
|
||||
|
||||
const saveOutcome = formComponent.form.outcomes.find((outcome) => outcome.name === FormOutcomeModel.SAVE_ACTION);
|
||||
expect(formComponent.isOutcomeButtonEnabled(saveOutcome)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should disable start process outcome button when disableStartProcessButton is true', () => {
|
||||
const formModel = new FormModel(cloudFormMock);
|
||||
formComponent.form = formModel;
|
||||
|
@@ -904,7 +904,7 @@ describe('FormComponent', () => {
|
||||
expect(formComponent.isOutcomeButtonEnabled(saveOutcome)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should disable save outcome button when the form is invalid', () => {
|
||||
it('should save outcome button be enabled when the form is invalid', () => {
|
||||
const formModel = new FormModel();
|
||||
formComponent.form = formModel;
|
||||
|
||||
@@ -926,7 +926,7 @@ describe('FormComponent', () => {
|
||||
name: FormOutcomeModel.SAVE_ACTION
|
||||
});
|
||||
|
||||
expect(formComponent.isOutcomeButtonEnabled(saveOutcome)).toBeFalsy();
|
||||
expect(formComponent.isOutcomeButtonEnabled(saveOutcome)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should disable start process outcome button when disableStartProcessButton is true', () => {
|
||||
|
Reference in New Issue
Block a user