mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-22924] Fix slow search results loading, limit number of pages (#7609)
* [MNT-22924] Fix slow search results loading, limit number of pages * Add unit test * Changed some of the values
This commit is contained in:
@@ -373,4 +373,23 @@ describe('PaginationComponent', () => {
|
||||
expect(component.pages).toEqual([1]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('many pages', () => {
|
||||
it('should all the pages be available if equal or less than 100', () => {
|
||||
component.pagination = new FakePaginationInput(100, 30, 5);
|
||||
|
||||
expect(component.limitedPages.length).toBe(100);
|
||||
expect(component.pages).toEqual(component.limitedPages);
|
||||
});
|
||||
|
||||
it('should only some pages be available if over 100', () => {
|
||||
component.pagination = new FakePaginationInput(101, 30, 5);
|
||||
|
||||
const expectedPages = [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 101];
|
||||
console.log(component.pagination.totalItems, component.pagination.skipCount);
|
||||
expect(component.limitedPages).toEqual(expectedPages);
|
||||
expect(component.limitedPages).not.toEqual(component.pages);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user