mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-5458] - Reset filters when the filter input is not defined (rollback code causing regression) (#7151)
* Reset filters when the new filter param is undefined * Rollback more code, fix unit tests * Fix spaces after comma
This commit is contained in:
@@ -231,14 +231,11 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
expect(filterClickedSpy).toHaveBeenCalledWith(mockProcessFilters[0]);
|
||||
});
|
||||
|
||||
it('should reset the filter when the param is undefined', async () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(mockProcessFilters[0], undefined, false);
|
||||
component.currentFilter = mockProcessFilters[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(component.currentFilter).toEqual(undefined);
|
||||
});
|
||||
|
||||
|
@@ -95,10 +95,7 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
(res: ProcessFilterCloudModel[]) => {
|
||||
this.resetFilter();
|
||||
this.filters = res || [];
|
||||
|
||||
if (this.filterParam) {
|
||||
this.selectFilterAndEmit(this.filterParam);
|
||||
}
|
||||
this.success.emit(res);
|
||||
},
|
||||
(err: any) => {
|
||||
|
@@ -231,14 +231,11 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
expect(filterClickedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset the filter when the param is undefined', async () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(null, undefined, false);
|
||||
component.currentFilter = fakeGlobalServiceFilters[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(component.currentFilter).toBe(undefined);
|
||||
});
|
||||
|
||||
|
@@ -70,10 +70,7 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
|
||||
(res: ServiceTaskFilterCloudModel[]) => {
|
||||
this.resetFilter();
|
||||
this.filters = res || [];
|
||||
|
||||
if (this.filterParam) {
|
||||
this.selectFilterAndEmit(this.filterParam);
|
||||
}
|
||||
this.success.emit(res);
|
||||
},
|
||||
(err: any) => {
|
||||
@@ -101,6 +98,8 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
|
||||
if (this.currentFilter) {
|
||||
this.filterSelected.emit(this.currentFilter);
|
||||
}
|
||||
} else {
|
||||
this.currentFilter = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -248,14 +248,11 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
expect(filterClickedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset the filter when the param is undefined', async () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(fakeGlobalFilter[0], undefined, false);
|
||||
component.currentFilter = fakeGlobalFilter[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(component.currentFilter).toEqual(undefined);
|
||||
});
|
||||
|
||||
|
@@ -80,11 +80,7 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
|
||||
(res: TaskFilterCloudModel[]) => {
|
||||
this.resetFilter();
|
||||
this.filters = res || [];
|
||||
|
||||
if (this.filterParam) {
|
||||
this.selectFilterAndEmit(this.filterParam);
|
||||
}
|
||||
|
||||
this.updateFilterCounters();
|
||||
this.success.emit(res);
|
||||
},
|
||||
@@ -154,6 +150,8 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
|
||||
this.resetFilterCounter(this.currentFilter.key);
|
||||
this.filterSelected.emit(this.currentFilter);
|
||||
}
|
||||
} else {
|
||||
this.currentFilter = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user