mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-22944 Disable form rules form read only form (#9775)
This commit is contained in:
@@ -710,6 +710,17 @@ describe('Form Renderer Component', () => {
|
||||
expect(rulesManager.initialize).toHaveBeenCalledWith(formModel);
|
||||
});
|
||||
|
||||
it('should NOT call the Form Rules Manager init when the form is read only', () => {
|
||||
spyOn(rulesManager, 'initialize');
|
||||
const formModel = formService.parseForm(customWidgetFormWithVisibility.formRepresentation.formDefinition);
|
||||
|
||||
formRendererComponent.formDefinition = formModel;
|
||||
formRendererComponent.readOnly = true;
|
||||
formRendererComponent.ngOnInit();
|
||||
|
||||
expect(rulesManager.initialize).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call the Form Rules Manager destroy on component destruction', () => {
|
||||
spyOn(rulesManager, 'destroy');
|
||||
|
||||
|
@@ -66,6 +66,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
formDefinition: FormModel;
|
||||
|
||||
@Input()
|
||||
readOnly = false;
|
||||
|
||||
debugMode: boolean;
|
||||
|
||||
fields: FormFieldModel[];
|
||||
@@ -79,7 +82,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.runMiddlewareServices();
|
||||
this.formRulesManager.initialize(this.formDefinition);
|
||||
if (!this.readOnly) {
|
||||
this.formRulesManager.initialize(this.formDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
Reference in New Issue
Block a user