diff --git a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.html b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.html index 5bcdc3efa5..fc1e74a8be 100644 --- a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.html +++ b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.html @@ -2,12 +2,11 @@ [class.adf-invalid]="!field.isValid" [class.adf-readonly]="field.readOnly" [id]="field.id">
- + +
diff --git a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts index 7df6fc7178..a7bc65598d 100644 --- a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts +++ b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts @@ -134,10 +134,15 @@ describe('RadioButtonsWidgetComponent', () => { let fixture: ComponentFixture; let element: HTMLElement; let stubFormService: FormService; - const restOption: FormFieldOption[] = [{ id: 'opt-1', name: 'opt-name-1' }, { - id: 'opt-2', - name: 'opt-name-2' - }]; + const restOption: FormFieldOption[] = [ + { + id: 'opt-1', + name: 'opt-name-1' + }, + { + id: 'opt-2', + name: 'opt-name-2' + }]; beforeEach(async(() => { fixture = TestBed.createComponent(RadioButtonsWidgetComponent); @@ -149,6 +154,28 @@ describe('RadioButtonsWidgetComponent', () => { fixture.destroy(); }); + describe('and radioButton is readonly', () => { + + beforeEach(async(() => { + stubFormService = fixture.debugElement.injector.get(FormService); + radioButtonWidget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }), { + id: 'radio-id', + name: 'radio-name', + type: FormFieldTypes.RADIO_BUTTONS, + readOnly: true + }); + radioButtonWidget.field.isVisible = true; + const fakeContainer = new ContainerModel(radioButtonWidget.field); + radioButtonWidget.field.form.fields.push(fakeContainer); + fixture.detectChanges(); + })); + + it('should show radio buttons as text when is readonly', async(() => { + expect(element.querySelector('display-text-widget')).toBeDefined(); + })); + + }); + describe('and radioButton is populated via taskId', () => { beforeEach(async(() => {