mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-2175] Document List requests are executed twice when opening the copy and move dialog (#2960)
* [ADF-2175] Document List requests are executed twice when opening the dialog fixed bug * [ADF-2175] added unit tests for the change & refactored initial code
This commit is contained in:
parent
adb0b8df38
commit
d731cc651c
@ -1204,4 +1204,22 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
expect(documentList.reload).not.toHaveBeenCalled();
|
expect(documentList.reload).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should NOT reload data on first call of onNgChanges', () => {
|
||||||
|
spyOn(documentList, 'reload').and.stub();
|
||||||
|
|
||||||
|
const firstChange = true;
|
||||||
|
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 10, firstChange) });
|
||||||
|
|
||||||
|
expect(documentList.reload).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reload data on NON-first calls of onNgChanges', () => {
|
||||||
|
spyOn(documentList, 'reload').and.stub();
|
||||||
|
|
||||||
|
const firstChange = true;
|
||||||
|
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 10, !firstChange) });
|
||||||
|
|
||||||
|
expect(documentList.reload).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -567,6 +567,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
|
|
||||||
private isSkipCountChanged(changePage: SimpleChanges) {
|
private isSkipCountChanged(changePage: SimpleChanges) {
|
||||||
return changePage.skipCount &&
|
return changePage.skipCount &&
|
||||||
|
!changePage.skipCount.isFirstChange() &&
|
||||||
changePage.skipCount.currentValue !== null &&
|
changePage.skipCount.currentValue !== null &&
|
||||||
changePage.skipCount.currentValue !== undefined &&
|
changePage.skipCount.currentValue !== undefined &&
|
||||||
changePage.skipCount.currentValue !== changePage.skipCount.previousValue;
|
changePage.skipCount.currentValue !== changePage.skipCount.previousValue;
|
||||||
@ -574,6 +575,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
|
|
||||||
private isMaxItemsChanged(changePage: SimpleChanges) {
|
private isMaxItemsChanged(changePage: SimpleChanges) {
|
||||||
return changePage.maxItems &&
|
return changePage.maxItems &&
|
||||||
|
!changePage.maxItems.isFirstChange() &&
|
||||||
changePage.maxItems.currentValue &&
|
changePage.maxItems.currentValue &&
|
||||||
changePage.maxItems.currentValue !== changePage.maxItems.previousValue;
|
changePage.maxItems.currentValue !== changePage.maxItems.previousValue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user