[ADF-3123] removed default choice for the first radio button (#3462)

This commit is contained in:
Vito 2018-06-08 14:10:32 +01:00 committed by Eugenio Romano
parent 6cad49a88e
commit fc26eb42f3
3 changed files with 3 additions and 5 deletions

View File

@ -822,7 +822,7 @@ describe('FormComponent', () => {
let labelField = formFields.find(field => field.id === 'label');
let radioField = formFields.find(field => field.id === 'radio');
expect(labelField.value).toBe('empty');
expect(radioField.value).toBe('option_1');
expect(radioField.value).toBeNull();
let formValues: any = {};
formValues.label = {

View File

@ -328,7 +328,7 @@ describe('FormFieldModel', () => {
expect(form.values['radio-1']).toEqual(field.options[1]);
});
it('should update form with the first radio button value', () => {
it('radio button value should be null when no default is set', () => {
let form = new FormModel();
let field = new FormFieldModel(form, {
id: 'radio-2',
@ -340,7 +340,7 @@ describe('FormFieldModel', () => {
});
field.value = 'missing';
expect(form.values['radio-2']).toEqual(field.options[0]);
expect(form.values['radio-2']).toBeUndefined();
});
it('should not update form with display-only field value', () => {

View File

@ -317,8 +317,6 @@ export class FormFieldModel extends FormWidgetModel {
opt.id === value || opt.name === value || (value && (opt.id === value.id || opt.name === value.name)));
if (entry.length > 0) {
value = entry[0].id;
} else {
value = this.options[0] ? this.options[0].id : json.value;
}
}