mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-23648] Clicking on Load More button no longer causes scroll position to reset to top (#8951)
* [MNT-23648] Resolved issue where clicking on load more button would reset the scroll position to top when copying/moving a folder * [MNT-23648] Revert fix * [MNT-23648] Resolved issue where clicking on load more button would reset the scroll position to top when copying/moving a folder * [MNT-23648] Added test case to cover new functionality * [MNT-23648] Fixed unit tests
This commit is contained in:
@@ -1427,6 +1427,31 @@ describe('DocumentList', () => {
|
||||
expect(documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not show loading state if pagination is updated with merge setting as true', fakeAsync (() => {
|
||||
spyFolderNode = spyOn(documentListService, 'loadFolderByNodeId').and.callFake(() =>
|
||||
of(new DocumentLoaderNode(null, {
|
||||
list: {
|
||||
pagination: {},
|
||||
entries: mockPreselectedNodes
|
||||
}
|
||||
}))
|
||||
);
|
||||
fixture.detectChanges();
|
||||
const fakeDatatableRows = [
|
||||
new ShareDataRow(mockPreselectedNodes[0], contentService, null),
|
||||
new ShareDataRow(mockPreselectedNodes[1], contentService, null)
|
||||
];
|
||||
documentList.data.setRows(fakeDatatableRows);
|
||||
documentList.updatePagination({
|
||||
maxItems: 10,
|
||||
skipCount: 0,
|
||||
merge: true
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#adf-document-list-loading')).toBe(null);
|
||||
}));
|
||||
|
||||
it('should NOT reload data on first call of ngOnChanges', () => {
|
||||
spyOn(documentList, 'reload').and.stub();
|
||||
|
||||
|
@@ -550,12 +550,12 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
}
|
||||
|
||||
reload() {
|
||||
reload(hideLoadingSpinner = false) {
|
||||
this.resetSelection();
|
||||
this.reloadWithoutResettingSelection();
|
||||
this.reloadWithoutResettingSelection(hideLoadingSpinner);
|
||||
}
|
||||
|
||||
reloadWithoutResettingSelection() {
|
||||
reloadWithoutResettingSelection(hideLoadingSpinner = false) {
|
||||
if (this.node) {
|
||||
if (this.data) {
|
||||
this.data.loadPage(this.node, this._pagination.merge, null);
|
||||
@@ -565,7 +565,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
this.syncPagination();
|
||||
this.onDataReady(this.node);
|
||||
} else {
|
||||
this.loadFolder();
|
||||
this.loadFolder(hideLoadingSpinner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,8 +713,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
}
|
||||
|
||||
loadFolder() {
|
||||
if (!this._pagination.merge) {
|
||||
loadFolder(hideLoadingSpinner = false) {
|
||||
if (!hideLoadingSpinner) {
|
||||
this.setLoadingState(true);
|
||||
}
|
||||
|
||||
@@ -944,9 +944,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
updatePagination(requestPaginationModel: RequestPaginationModel) {
|
||||
this._pagination.maxItems = requestPaginationModel.maxItems;
|
||||
this._pagination.merge = requestPaginationModel.merge;
|
||||
this._pagination.skipCount = requestPaginationModel.skipCount;
|
||||
this.reload();
|
||||
this.reload(requestPaginationModel.merge);
|
||||
}
|
||||
|
||||
private syncPagination() {
|
||||
|
Reference in New Issue
Block a user