mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACA-4208] - Fix date filter for range (#6684)
This commit is contained in:
parent
fc275e82d0
commit
c45ea0fb0b
@ -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'];
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user