[ACA-3080] Remove selecting first filter by default when no defaults … (#5619)

* [ACA-3080] Remove selecting first filter by default when no defaults are provided

* [ACA-3080] Fix demo shell, emit when filter is selected

* [ACA-3080] Align demo shell

* [ACA-3080] Align task filters demo shell, emit when task filter selected
This commit is contained in:
arditdomi
2020-04-21 15:46:44 +01:00
committed by GitHub
parent 53b01ae594
commit af7eb53251
15 changed files with 24 additions and 121 deletions

View File

@@ -144,23 +144,6 @@ describe('TaskFiltersComponent', () => {
component.ngOnInit();
});
it('should select the first filter as default', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
const appId = '1';
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.currentFilter).toBeDefined();
expect(component.currentFilter.name).toEqual('FakeInvolvedTasks');
done();
});
});
it('should be able to fetch and select the default if the input filter is not valid', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalEmptyFilterPromise));
spyOn(component, 'createFiltersByAppId').and.stub();
@@ -194,25 +177,6 @@ describe('TaskFiltersComponent', () => {
});
});
it('should select the default task filter if filter input does not exist', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
const appId = '1';
const change = new SimpleChange(null, appId, true);
fixture.detectChanges();
component.ngOnChanges({ 'appId': change });
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.currentFilter).toBeDefined();
expect(component.currentFilter.name).toEqual('FakeInvolvedTasks');
done();
});
});
it('should select the task filter based on the input by index param', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalFilterPromise));

View File

@@ -166,9 +166,6 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
(newFilter.name.toLocaleLowerCase() === filter.name.toLocaleLowerCase())
));
}
if (!this.currentFilter) {
this.selectDefaultTaskFilter();
}
}
public selectFilterAndEmit(newFilter: FilterParamsModel) {