mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-6209] Remove default dropdown value (#7331)
This commit is contained in:
@@ -101,6 +101,18 @@ describe('FormFieldValidator', () => {
|
|||||||
expect(validator.validate(field)).toBe(false);
|
expect(validator.validate(field)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fail for dropdown with null value', () => {
|
||||||
|
const field = new FormFieldModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.DROPDOWN,
|
||||||
|
value: null,
|
||||||
|
required: true,
|
||||||
|
options: [{ id: 'one', name: 'one' }],
|
||||||
|
selectionType: 'multiple'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(validator.validate(field)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('should fail for radio buttons', () => {
|
it('should fail for radio buttons', () => {
|
||||||
const field = new FormFieldModel(new FormModel(), {
|
const field = new FormFieldModel(new FormModel(), {
|
||||||
type: FormFieldTypes.RADIO_BUTTONS,
|
type: FormFieldTypes.RADIO_BUTTONS,
|
||||||
|
@@ -60,7 +60,7 @@ export class RequiredFieldValidator implements FormFieldValidator {
|
|||||||
|
|
||||||
if (field.type === FormFieldTypes.DROPDOWN) {
|
if (field.type === FormFieldTypes.DROPDOWN) {
|
||||||
if (field.hasMultipleValues) {
|
if (field.hasMultipleValues) {
|
||||||
return !!field.value.length;
|
return Array.isArray(field.value) && !!field.value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.hasEmptyValue && field.emptyOption) {
|
if (field.hasEmptyValue && field.emptyOption) {
|
||||||
|
Reference in New Issue
Block a user