use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.CharacterBoxFieldDefinition in project kie-wb-common by kiegroup.
the class DataObjectFormModelHandlerTest method checkCommonProperties.
private FieldDefinition checkCommonProperties(String dataFieldName) {
ObjectProperty dataField = dataObject.getProperty(dataFieldName);
FieldDefinition formField = fieldManager.getDefinitionByModelProperty(formModel.getProperty(dataFieldName));
String dataFieldClassName = dataField.getClassName();
TypeInfo fieldTypeInfo = formField.getFieldTypeInfo();
// test common properties
assertEquals(dataFieldClassName, fieldTypeInfo.getClassName());
assertNotEquals(TypeKind.ENUM, fieldTypeInfo.getType());
assertEquals(dataField.isMultiple(), fieldTypeInfo.isMultiple());
assertEquals(dataField.getName().toLowerCase(), formField.getLabel().toLowerCase());
assertEquals(dataField.getName(), formField.getBinding());
assertEquals(dataFieldClassName, formField.getStandaloneClassName());
assertFalse(formField.getReadOnly());
assertFalse(formField.getRequired());
assertTrue(formField.getValidateOnChange());
// test interface specific properties
if (formField instanceof HasPlaceHolder) {
assertEquals(dataField.getName().toLowerCase(), ((HasPlaceHolder) formField).getPlaceHolder().toLowerCase());
}
if (formField instanceof HasMaxLength) {
long maxLength = ((HasMaxLength) formField).getMaxLength();
assertTrue(formField instanceof CharacterBoxFieldDefinition ? maxLength == 1 : maxLength == 100);
}
return formField;
}
Aggregations