From a3cbf9bcd35e4857d55c9a4db8552f4accef6b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Baptiste=20Mah=C3=A9?= Date: Fri, 7 Feb 2020 17:19:27 +0000 Subject: [PATCH] [ADF-4920] Fixed checkbox dropdown style when invalid (#5444) * ADF-4920 Fixed checkbox dropdown style when invalid * ADF-4920 Corrected misspelling --- .../widgets/checkbox/checkbox.widget.html | 3 +- .../widgets/checkbox/checkbox.widget.spec.ts | 75 +++++++++++++++++++ lib/core/form/components/widgets/form.scss | 18 +++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 lib/core/form/components/widgets/checkbox/checkbox.widget.spec.ts diff --git a/lib/core/form/components/widgets/checkbox/checkbox.widget.html b/lib/core/form/components/widgets/checkbox/checkbox.widget.html index 0705bda422..4c80eef031 100644 --- a/lib/core/form/components/widgets/checkbox/checkbox.widget.html +++ b/lib/core/form/components/widgets/checkbox/checkbox.widget.html @@ -1,4 +1,5 @@ -
+
{ + + let widget: CheckboxWidgetComponent; + let fixture: ComponentFixture; + let element: HTMLElement; + + setupTestBed({ + imports: [ + NoopAnimationsModule, + FormBaseModule + ], + providers: [ + TranslateStore, + TranslateService, + { provide: TranslateLoader, useClass: TranslateLoaderService } + ] + }); + + beforeEach(() => { + fixture = TestBed.createComponent(CheckboxWidgetComponent); + + widget = fixture.componentInstance; + element = fixture.nativeElement; + }); + + describe('when template is ready', () => { + + beforeEach(() => { + widget.field = new FormFieldModel(new FormModel({taskId: 'fake-task-id'}), { + id: 'check-id', + name: 'check-name', + value: '', + type: FormFieldTypes.BOOLEAN, + readOnly: false, + required: true + }); + fixture.detectChanges(); + }); + + it('should be marked as invalid when required', async(() => { + fixture.whenStable().then(() => { + expect(element.querySelector('.adf-invalid')).not.toBeNull(); + }); + })); + + }); +}); diff --git a/lib/core/form/components/widgets/form.scss b/lib/core/form/components/widgets/form.scss index 2b83e150d5..70692a4726 100644 --- a/lib/core/form/components/widgets/form.scss +++ b/lib/core/form/components/widgets/form.scss @@ -43,6 +43,24 @@ background-color: #f44336 !important; } + .mat-checkbox { + color: mat-color($warn); + .mat-checkbox-frame { + border-color: mat-color($warn); + } + } + + .mat-select { + + &-value { + color: mat-color($warn); + } + &-arrow { + color: mat-color($warn); + } + + } + .adf-file { border-color: mat-color($warn); }