[ACA-4208] - Fix date filter for range (#6684)

This commit is contained in:
Silviu Popa 2021-02-22 16:43:48 +02:00 committed by GitHub
parent fc275e82d0
commit c45ea0fb0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -836,6 +836,39 @@ describe('EditProcessFilterCloudComponent', () => {
component.onFilterChange(); component.onFilterChange();
}); });
it('should set date range filter type when range is selected', (done) => {
component.appName = 'fake';
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIdChange });
fixture.detectChanges();
const dateFilter = {
startDate: moment().startOf('day').toISOString(true),
endDate: moment().endOf('day').toISOString(true)
};
component.onDateRangeFilterChanged(dateFilter, {
key: 'completedDateRange',
label: '',
type: 'date-range',
value: '',
attributes: {
dateType: 'completedDateType',
from: '_completedFrom',
to: '_completedTo'
}
});
fixture.detectChanges();
component.filterChange.subscribe(() => {
const completedDateTypeControl: AbstractControl = component.editProcessFilterForm.get('completedDateType');
expect(completedDateTypeControl.value).toEqual(DateCloudFilterType.RANGE);
done();
});
component.onFilterChange();
});
it('should set the correct started date range when date range option is changed', (done) => { it('should set the correct started date range when date range option is changed', (done) => {
component.appName = 'fake'; component.appName = 'fake';
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange']; component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];

View File

@ -346,6 +346,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
this.editProcessFilterForm.get(property.attributes?.to).setValue( this.editProcessFilterForm.get(property.attributes?.to).setValue(
dateRange.endDate ? dateRange.endDate : null dateRange.endDate ? dateRange.endDate : null
); );
this.editProcessFilterForm.get(property.attributes.dateType).setValue(DateCloudFilterType.RANGE);
} }
onChangedUser(users: IdentityUserModel[], processProperty: ProcessFilterProperties) { onChangedUser(users: IdentityUserModel[], processProperty: ProcessFilterProperties) {