#1115 - fixed error on test

This commit is contained in:
Vito Albano 2016-11-25 16:09:08 +00:00 committed by Mario Romano
parent 94db90eb19
commit 5d1e638df1

View File

@ -158,11 +158,11 @@ export class WidgetVisibilityService {
private isSearchedField(field: FormFieldModel, fieldToFind: string) { private isSearchedField(field: FormFieldModel, fieldToFind: string) {
let forrmattedFieldName = this.removeLabel(field, fieldToFind); let forrmattedFieldName = this.removeLabel(field, fieldToFind);
return field.name.toUpperCase() === forrmattedFieldName.toUpperCase(); return field.name ? field.name.toUpperCase() === forrmattedFieldName.toUpperCase() : false;
} }
private removeLabel(field: FormFieldModel, fieldToFind) { private removeLabel(field: FormFieldModel, fieldToFind) {
let formattedFieldName = fieldToFind; let formattedFieldName = fieldToFind || '';
if (field.fieldType === 'RestFieldRepresentation' && fieldToFind.indexOf('_LABEL') > 0) { if (field.fieldType === 'RestFieldRepresentation' && fieldToFind.indexOf('_LABEL') > 0) {
formattedFieldName = fieldToFind.substring(0, fieldToFind.length - 6); formattedFieldName = fieldToFind.substring(0, fieldToFind.length - 6);
} }