From d51e22f9f464ba871fea37a361fc42754e91dda0 Mon Sep 17 00:00:00 2001 From: siva kumar Date: Thu, 8 Aug 2019 00:18:06 +0530 Subject: [PATCH] * Fixed theaming issue on the filters* Fixed fixed clear action default value. (#4980) --- .../process-service.component.scss | 5 --- .../card-view-dateitem.component.spec.ts | 37 ++++++++++++++++++- .../card-view-dateitem.component.ts | 9 +++-- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/demo-shell/src/app/components/process-service/process-service.component.scss b/demo-shell/src/app/components/process-service/process-service.component.scss index cb6ee5e4cc..e72b969d66 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.scss +++ b/demo-shell/src/app/components/process-service/process-service.component.scss @@ -93,11 +93,6 @@ align-items: center; } - .mat-expansion-panel-header.mat-expanded .mat-expansion-panel-header-title { - color: mat-color($primary); - opacity: 1; - } - .adf-accordion-title-padding { padding-left: 20px; } diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts index 74399702c7..8b332eb7eb 100644 --- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts +++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts @@ -107,6 +107,7 @@ describe('CardViewDateItemComponent', () => { format: '', editable: true }); + component.displayClearAction = false; component.editable = true; fixture.detectChanges(); @@ -205,7 +206,7 @@ describe('CardViewDateItemComponent', () => { ); })); - it('should render the clear icon in case of editable:true', () => { + it('should render the clear icon in case of displayClearAction:true', () => { component.editable = true; component.property.editable = true; component.property.value = 'Jul 10 2017'; @@ -225,7 +226,7 @@ describe('CardViewDateItemComponent', () => { expect(datePickerClearToggle).toBeNull('Clean Icon should not be in DOM'); }); - it('should not render the clear icon in case displayClearAction is set false', () => { + it('should not render the clear icon in case of displayClearAction:false', () => { component.editable = true; component.property.editable = true; component.displayClearAction = false; @@ -250,4 +251,36 @@ describe('CardViewDateItemComponent', () => { } ); })); + + it('should remove the property default value after a successful clear attempt', async(() => { + component.editable = true; + component.property.editable = true; + component.property.default = 'Jul 10 2017'; + fixture.detectChanges(); + + component.onDateClear(); + + fixture.whenStable().then( + (updateNotification) => { + expect(component.property.default).toBeNull(); + } + ); + })); + + it('should remove actual and default value after a successful clear attempt', async(() => { + component.editable = true; + component.property.editable = true; + component.property.default = 'Jul 10 2017'; + component.property.value = 'Jul 10 2017'; + fixture.detectChanges(); + + component.onDateClear(); + + fixture.whenStable().then( + (updateNotification) => { + expect(component.property.value).toBeNull(); + expect(component.property.default).toBeNull(); + } + ); + })); }); diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts index 3c662190bd..56f3b867bd 100644 --- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts +++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts @@ -91,15 +91,15 @@ export class CardViewDateItemComponent implements OnInit, OnDestroy { this.onDestroy$.complete(); } - showProperty() { + showProperty(): boolean { return this.displayEmpty || !this.property.isEmpty(); } - showClearAction() { - return !this.property.isEmpty() && this.displayClearAction; + showClearAction(): boolean { + return this.displayClearAction && (!this.property.isEmpty() || !!this.property.default); } - isEditable() { + isEditable(): boolean { return this.editable && this.property.editable; } @@ -122,6 +122,7 @@ export class CardViewDateItemComponent implements OnInit, OnDestroy { this.valueDate = null; this.cardViewUpdateService.update(this.property, null); this.property.value = null; + this.property.default = null; } }