mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4797] - fix null value for display text when the field it's not visible (#4987)
* fix reset display text value when it's not visible * change invalid unit test * change unit test * use alpha to test
This commit is contained in:
committed by
Eugenio Romano
parent
a8ef686cdd
commit
f9a8d3a4bf
@@ -530,7 +530,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
expect(fakeFormField.isVisible).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should reset value when the field is not visibile', () => {
|
||||
it('should notreset value when the field is not visibile', () => {
|
||||
visibilityObjTest.leftValue = 'test_1';
|
||||
visibilityObjTest.operator = '==';
|
||||
visibilityObjTest.rightType = WidgetTypeEnum.field;
|
||||
@@ -539,7 +539,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
|
||||
service.refreshEntityVisibility(fakeFormField);
|
||||
expect(fakeFormField.isVisible).toBeFalsy();
|
||||
expect(fakeFormField.value).toEqual(null);
|
||||
expect(fakeFormField.value).toEqual('FAKE_FORM_FIELD_VALUE');
|
||||
});
|
||||
|
||||
it('should return true when the visibility condition is not valid', () => {
|
||||
|
@@ -914,7 +914,7 @@ describe('WidgetVisibilityService', () => {
|
||||
expect(contModel.isVisible).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should set null value when the field is not visibile', () => {
|
||||
it('should not set null value when the field is not visibile', () => {
|
||||
visibilityObjTest.leftFormFieldId = 'test_4';
|
||||
visibilityObjTest.operator = '!=';
|
||||
visibilityObjTest.rightFormFieldId = 'dropdown';
|
||||
@@ -922,7 +922,7 @@ describe('WidgetVisibilityService', () => {
|
||||
|
||||
service.refreshEntityVisibility(fakeFormField);
|
||||
expect(fakeFormField.isVisible).toBeFalsy();
|
||||
expect(fakeFormField.value).toEqual(null);
|
||||
expect(fakeFormField.value).toEqual('FAKE_FORM_FIELD_VALUE');
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -48,9 +48,6 @@ export class WidgetVisibilityService {
|
||||
|
||||
refreshEntityVisibility(element: FormFieldModel | TabModel) {
|
||||
const visible = this.evaluateVisibility(element.form, element.visibilityCondition);
|
||||
if (!visible && element instanceof FormFieldModel) {
|
||||
element.value = null;
|
||||
}
|
||||
element.isVisible = visible;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user