mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-30863] updated validators to set proper button state (#10667)
This commit is contained in:
@@ -161,6 +161,46 @@ describe('FormFieldValidator', () => {
|
||||
|
||||
expect(validator.validate(field)).toBe(false);
|
||||
});
|
||||
|
||||
it('should succeed for file viewer', () => {
|
||||
const field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.ALFRESCO_FILE_VIEWER,
|
||||
value: [{ sys_id: '123', sys_name: 'screenshot_123' }],
|
||||
required: true
|
||||
});
|
||||
|
||||
expect(validator.validate(field)).toBe(true);
|
||||
});
|
||||
|
||||
it('should fail if file viewer has no value', () => {
|
||||
const field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.ALFRESCO_FILE_VIEWER,
|
||||
value: null,
|
||||
required: true
|
||||
});
|
||||
|
||||
expect(validator.validate(field)).toBe(false);
|
||||
});
|
||||
|
||||
it('should succeed for properties viewer', () => {
|
||||
const field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.PROPERTIES_VIEWER,
|
||||
value: [{ sys_id: '123', sys_name: 'screenshot_123' }],
|
||||
required: true
|
||||
});
|
||||
|
||||
expect(validator.validate(field)).toBe(true);
|
||||
});
|
||||
|
||||
it('should fail for properties viewer with no value', () => {
|
||||
const field = new FormFieldModel(new FormModel(), {
|
||||
type: FormFieldTypes.PROPERTIES_VIEWER,
|
||||
value: null,
|
||||
required: true
|
||||
});
|
||||
|
||||
expect(validator.validate(field)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NumberFieldValidator', () => {
|
||||
|
@@ -41,7 +41,9 @@ export class RequiredFieldValidator implements FormFieldValidator {
|
||||
FormFieldTypes.DYNAMIC_TABLE,
|
||||
FormFieldTypes.ATTACH_FOLDER,
|
||||
FormFieldTypes.DECIMAL,
|
||||
FormFieldTypes.DISPLAY_EXTERNAL_PROPERTY
|
||||
FormFieldTypes.DISPLAY_EXTERNAL_PROPERTY,
|
||||
FormFieldTypes.ALFRESCO_FILE_VIEWER,
|
||||
FormFieldTypes.PROPERTIES_VIEWER
|
||||
];
|
||||
|
||||
isSupported(field: FormFieldModel): boolean {
|
||||
|
Reference in New Issue
Block a user