mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3082] Task Filter - Custom Task filters don't work (#3402)
* [ADF-3082] Custom Task filters don't work. * Added an sorting input to the datatable. * Updated documentation for the recent changes. * Added testcases for the recent changes. * [ADF-3082] Custom Task filters don't work * Added a sorting input to the datatable * Added testcases to the recent changes. * Updated doc for the recent changes. * * Refactored task/process list dataSort. * * Refactored process/task list datasort method
This commit is contained in:
committed by
Maurizio Vitale
parent
a11766aa23
commit
9eae0fcc8f
@@ -207,6 +207,62 @@ describe('DataTable', () => {
|
||||
expect(element.querySelector('[data-automation-id="text_FAKE"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should set rows to the data when rows defined', () => {
|
||||
const dataRows =
|
||||
[
|
||||
{ name: 'test1' },
|
||||
{ name: 'test2' },
|
||||
{ name: 'test3' },
|
||||
{ name: 'test4' }
|
||||
];
|
||||
dataTable.data = new ObjectDataTableAdapter([],
|
||||
[new ObjectDataColumn({ key: 'name' })]
|
||||
);
|
||||
|
||||
dataTable.ngOnChanges({
|
||||
rows: new SimpleChange(null, dataRows, false)
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
const rows = dataTable.data.getRows();
|
||||
expect(rows[0].getValue('name')).toEqual('test1');
|
||||
expect(rows[1].getValue('name')).toEqual('test2');
|
||||
});
|
||||
|
||||
it('should set sort order if sorting is defined', () => {
|
||||
const dataSortObj = new DataSorting('created', 'desc');
|
||||
|
||||
const sort = [ 'created', 'desc' ];
|
||||
dataTable.data = new ObjectDataTableAdapter([],
|
||||
[new ObjectDataColumn({ key: 'name' })]
|
||||
);
|
||||
|
||||
dataTable.ngOnChanges({
|
||||
sorting: new SimpleChange(null, sort, false)
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
const dataSort = dataTable.data.getSorting();
|
||||
expect(dataSort).toEqual(dataSortObj);
|
||||
});
|
||||
|
||||
it('should set custom sort order', () => {
|
||||
const dataSortObj = new DataSorting('dummayName', 'asc');
|
||||
|
||||
const sort = [ 'dummayName', 'asc' ];
|
||||
dataTable.data = new ObjectDataTableAdapter([],
|
||||
[new ObjectDataColumn({ key: 'name' })]
|
||||
);
|
||||
dataTable.data.setSorting(new DataSorting('created', 'desc'));
|
||||
dataTable.ngOnChanges({
|
||||
sorting: new SimpleChange(null, sort, false)
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
const dataSort = dataTable.data.getSorting();
|
||||
expect(dataSort).toEqual(dataSortObj);
|
||||
});
|
||||
|
||||
it('should reset selection on mode change', () => {
|
||||
spyOn(dataTable, 'resetSelection').and.callThrough();
|
||||
|
||||
|
Reference in New Issue
Block a user