mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2406] [Document Picker] Unnecessary extra request is made on Load more click (#3019)
* [ADF-2406] [Document Picker] Unnecessary extra request is made on Load more click fixed bug * [ADF-2406] refactored code * [ADF-2406] added tests
This commit is contained in:
@@ -1278,4 +1278,30 @@ describe('DocumentList', () => {
|
||||
|
||||
expect(documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should NOT reload data on onNgChanges upon reset of skipCount to 0', () => {
|
||||
spyOn(documentList, 'reload').and.stub();
|
||||
|
||||
documentList.maxItems = 10;
|
||||
documentList.skipCount = 10;
|
||||
|
||||
const firstChange = true;
|
||||
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 0, !firstChange) });
|
||||
|
||||
expect(documentList.reload).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload data upon changing pagination setting skipCount to 0', () => {
|
||||
spyOn(documentList, 'reload').and.stub();
|
||||
|
||||
documentList.maxItems = 5;
|
||||
documentList.skipCount = 5;
|
||||
|
||||
documentList.updatePagination({
|
||||
maxItems: 5,
|
||||
skipCount: 0
|
||||
});
|
||||
|
||||
expect(documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user