mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2629] Fix infinite pagination and e2e parallel task (#3691)
* change infinite pagination logic make merge in share adapter a real merge * missing semi column * type problem * fix pagination infinite test * tentative file detector * add other remote files for webdriver * parallel execution test * fix refresh browser e2e * missing driver remote in util
This commit is contained in:
committed by
Eugenio Romano
parent
2602879cba
commit
83b2857097
@@ -100,7 +100,7 @@ describe('InfinitePaginationComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
component.loadMore.subscribe((newPagination: Pagination) => {
|
||||
expect(newPagination.skipCount).toBe(10);
|
||||
expect(newPagination.skipCount).toBe(0);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ describe('InfinitePaginationComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.pagination).toBe(pagination);
|
||||
expect(component.pageSize).toBe(pagination.maxItems);
|
||||
expect(component.pageSize).toBe(25);
|
||||
});
|
||||
|
||||
it('should call the target\'s updatePagination on invoking the onLoadMore', () => {
|
||||
@@ -139,7 +139,7 @@ describe('InfinitePaginationComponent', () => {
|
||||
|
||||
component.onLoadMore();
|
||||
|
||||
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444, skipCount: 444, totalItems: 888, hasMoreItems: true, merge: true });
|
||||
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 469, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true });
|
||||
});
|
||||
|
||||
it('should unsubscribe from the target\'s pagination on onDestroy', () => {
|
||||
|
@@ -27,6 +27,7 @@ import { Pagination } from 'alfresco-js-api';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { PaginationComponentInterface } from './pagination-component.interface';
|
||||
import { PaginationModel } from '../models/pagination.model';
|
||||
import { UserPreferencesService } from '../services/user-preferences.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-infinite-pagination',
|
||||
@@ -68,7 +69,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
||||
|
||||
private paginationSubscription: Subscription;
|
||||
|
||||
constructor(private cdr: ChangeDetectorRef) {
|
||||
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -76,7 +77,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
||||
this.paginationSubscription = this.target.pagination.subscribe(pagination => {
|
||||
this.isLoading = false;
|
||||
this.pagination = pagination;
|
||||
this.pageSize = pagination.maxItems;
|
||||
this.pageSize = this.userPreferencesService.paginationSize || this.pageSize;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
@@ -87,12 +88,12 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
||||
}
|
||||
|
||||
onLoadMore() {
|
||||
this.pagination.skipCount += this.pageSize;
|
||||
this.pagination.skipCount = this.pagination.skipCount;
|
||||
this.pagination.skipCount = 0;
|
||||
this.pagination.maxItems = this.pagination.maxItems + this.pageSize;
|
||||
this.pagination.merge = true;
|
||||
this.loadMore.next(this.pagination);
|
||||
|
||||
if ((this.pagination.skipCount + this.pageSize) > this.pagination.totalItems) {
|
||||
if (this.pagination.maxItems >= this.pagination.totalItems) {
|
||||
this.pagination.hasMoreItems = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user